Commit Graph

6726 Commits

Author SHA1 Message Date
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
Guido van Rossum aed51d8121 SF patch 590294: os._execvpe security fix (Zack Weinberg).
1) Do not attempt to exec a file which does not exist
just to find out what error the operating system
returns. This is an exploitable race on all platforms
that support symbolic links.

2) Immediately re-raise the exception if we get an
error other than errno.ENOENT or errno.ENOTDIR. This
may need to be adapted for other platforms.

(As a security issue, this should be considered for 2.1
and 2.2 as well as 2.3.)
2002-08-05 16:13:24 +00:00
Kurt B. Kaiser 8dcdb77132 GvR provided solution to the socket rebinding timeout problem.
M PyShell.py
M rpc.py
M run.py
2002-08-05 03:52:10 +00:00
Martin v. Löwis 4c561b36a0 Test whether a Cyrillic text correctly appears in a Unicode literal. 2002-08-05 01:32:09 +00:00
Tim Peters 6782d6aa91 We don't really need the name of the test in the "test skipped" msg, and
having it there causes the line to wrap.
2002-08-04 22:55:35 +00:00
Tim Peters 283ead8bf2 Oops! Forgot the closing paren. 2002-08-04 22:52:30 +00:00
Tim Peters 32ef169339 Finally got around to figuring out and documenting why this test fails
on Windows.  The test_sequence() ERROR is easily repaired if we're
willing to add an os.unlink() line to mhlib's updateline().  The
test_listfolders FAIL I gave up on -- I don't remember enough about Unix
link esoterica to recall why a link count of 2 is something a well-
written program should be keenly interested in <wink>.
2002-08-04 22:35:31 +00:00
Martin v. Löwis a729daf2e4 Add encoding declaration. 2002-08-04 17:28:33 +00:00
Martin v. Löwis 09776b7afd Add encoding declaration. 2002-08-04 17:22:59 +00:00
Tim Peters 8d30b1e673 I don't know what's going on with this test, but the last change from
Piers obviously couldn't have passed on any platform.  Fiddling it so it
works (for a meaning of "works" no stronger than "doesn't fail" <wink>).
2002-08-04 06:53:18 +00:00
Andrew MacIntyre 4104db39b8 - comment improvement
- implement viable library search routine for EMX
2002-08-04 06:21:25 +00:00
Andrew MacIntyre 428a38c002 add parameter missing following Jeremy's compiler class refactoring 2002-08-04 06:17:08 +00:00
Tim Peters 6681de2455 _siftup(): __le__ is now the only comparison operator used on array
elements.
2002-08-03 19:20:16 +00:00
Piers Lauder dc96ae6c79 revert to version 1.2 2002-08-03 11:14:43 +00:00
Tim Peters 0cd53a6c37 Added new heapreplace(heap, item) function, to pop (and return) the
currently-smallest value, and add item, in one gulp.  See the second
N-Best algorithm in the test suite for a natural use.
2002-08-03 10:10:10 +00:00
Tim Peters 657fe38241 Large code rearrangement to use better algorithms, in the sense of needing
substantially fewer array-element compares.  This is best practice as of
Kntuh Volume 3 Ed 2, and the code is actually simpler this way (although
the key idea may be counter-intuitive at first glance!  breaking out of
a loop early loses when it costs more to try to get out early than getting
out early saves).
Also added a comment block explaining the difference and giving some real
counts; demonstrating that heapify() is more efficient than repeated
heappush(); and emphasizing the obvious point thatlist.sort() is more
efficient if what you really want to do is sort.
2002-08-03 09:56:52 +00:00
Tim Peters 30e0beab6d Remove cut 'n paste silliness. 2002-08-03 02:17:41 +00:00
Tim Peters aa7d24319e Minor fiddling, including a simple class to implement a heap iterator
in the test file.  I have docs for heapq.heapify ready to check in, but
Jack appears to have left behind a stale lock in the Doc/lib directory.
2002-08-03 02:11:26 +00:00
Guido van Rossum fbb299226d Augment credits. 2002-08-02 22:01:37 +00:00
Tim Peters 28c25527c2 Hmm! I thought I checked this in before! Oh well.
Added new heapify() function, which transforms an arbitrary list into a
heap in linear time; that's a fundamental tool for using heaps in real
life <wink>.

Added heapyify() test.  Added a "less naive" N-best algorithm to the test
suite, and noted that this could actually go much faster (building on
heapify()) if we had max-heaps instead of min-heaps (the iterative method
is appropriate when all the data isn't known in advance, but when it is
known in advance the tradeoffs get murkier).
2002-08-02 21:48:06 +00:00
Guido van Rossum 4b48d6b37c Add a PEP-263-style encoding turd^H^H^H^Hdeclaration, because there's
a c-cedilla in one of the docstrings.
2002-08-02 20:23:56 +00:00
Tim Peters 62abc2f6ce heappop(): Added comments; simplified and sped the code. 2002-08-02 20:09:14 +00:00
Tim Peters a0b3a00bc5 heappop(): Use "while True" instead of "while 1". 2002-08-02 19:45:37 +00:00
Tim Peters d2cf1ab0e2 check_invariant(): Use the same child->parent "formula" used by heapq.py. 2002-08-02 19:41:54 +00:00
Tim Peters d9ea39db84 Don't use true division where int division was intended. For that matter,
don't use division at all.
2002-08-02 19:16:44 +00:00
Guido van Rossum 0b19178736 Adding the heap queue algorithm, per discussion in python-dev last
week.
2002-08-02 18:29:53 +00:00
Skip Montanaro 404378f834 catch the situation where Berkeley DB is used to emulate dbm(3) library
functions.  In this case, calling dbm.open("foo", "c") actually creates a
file named "foo.db".
2002-08-02 17:12:15 +00:00
Skip Montanaro 13a5678a51 regression test for the whichdb module 2002-08-02 17:10:10 +00:00
Guido van Rossum 37c3b2788b Add Kevin O'Connor, author of the heapq code. 2002-08-02 16:50:58 +00:00
Guido van Rossum 0a82438859 Adding the heap queue algorithm, per discussion in python-dev last
week.
2002-08-02 16:44:32 +00:00
Skip Montanaro f4433303a8 testGetServByName shouldn't check for getservbyname - the socket module
should always have it.
2002-08-02 15:52:30 +00:00
Tim Peters d5f4359458 New test %sort. This takes a sorted list, picks 1% of the list positions
at random, and replaces the elements at those positions with new random
values.  I was pleasantly surprised by how fast this goes!  It's hard to
conceive of an algorithm that could special-case for this effectively.
Plus it's exactly what happens if a burst of gamma rays corrupts your
sorted database on disk <wink>.

 i    2**i  *sort  ...  %sort
15   32768   0.18  ...   0.03
16   65536   0.24  ...   0.04
17  131072   0.53  ...   0.08
18  262144   1.17  ...   0.16
19  524288   2.56  ...   0.35
20 1048576   5.54  ...   0.77
2002-08-02 05:46:09 +00:00
Skip Montanaro d3c884d4ea modify testGetServByName so it tries a few different protocols. In this day
and age of rampant computer breakins I imagine there are plenty of systems
with telnet disabled.  Successful check of at least one getservbyname() call
is required for success
2002-08-02 02:19:46 +00:00
Guido van Rossum b54c27c861 Fix for SF bug 570678 (can't flush read-only file on Mac OS X). 2002-08-01 21:12:35 +00:00
Guido van Rossum 0dbab4c560 SF patch 588728 (Nathan Srebro).
The __delete__ method wrapper for descriptors was not supported

(I added a test, too.)

2.2 bugfix candidate.
2002-08-01 14:39:25 +00:00
Tim Peters 2d8b765cc9 New test for sorting sanity. Note that this will fail in earlier Pythons,
in the stability tests.

Bizarre:  this takes 11x longer to run if and only if test_longexp is
run before it, on my box.  The bigger REPS is in test_longexp, the
slower this gets.  What happens on your box?  It's not gc on my box
(which is good, because gc isn't a plausible candidate here).

The slowdown is massive in the parts of test_sort that implicitly
invoke a new-style class's __lt__ or __cmp__ methods.  If I boost
REPS large enough in test_longexp, even the test_sort tests on an array
of size 64 visibly c-r-a-w-l.  The relative slowdown is even worse in
a debug build.  And if I reduce REPS in test_longexp, the slowdown in
test_sort goes away.

test_longexp does do horrid things to Win98's management of user
address space, but I thought I had made that a whole lot better a month
or so ago (by overallocating aggressively in the parser).
2002-08-01 02:23:06 +00:00
Tim Peters 6be147541a Restore a full arglist to the socket wrapper, so it supports keyword
arguments correctly too.
2002-07-31 17:48:02 +00:00
Tim Peters 8c3fb874ae For platforms (like Windows) that wrap _socket.socket:
+ Don't change the arglist requirements.
+ Give the wrapper the same docstring as _socket.socket (it didn't
  have any docstring).
2002-07-31 17:32:11 +00:00
Tim Peters 108b7918b0 Reverting this to rev 1.3. It's apparently broken everywhere at rev
1.6, and pierslauder didn't respond to email about it on Monday.
2002-07-31 16:42:33 +00:00
Guido van Rossum b995eb79a0 Enable test_socket again, if only to prevent mistakes like Jeremy
thinking that he was running his new test by running "make test".
Also, I can't get this to fail any more.  Your turn. :-)
2002-07-31 16:08:40 +00:00
Jeremy Hylton cbd5b89571 Repair testNtoH for large long arguments.
If the long is large enough, the return value will be a negative int.
In this case, calling the function a second time won't return the
original value passed in.
2002-07-31 15:57:39 +00:00
Barry Warsaw 408b6d34de Complete the absolute import patch for the test suite. All relative
imports of test modules now import from the test package.  Other
related oddities are also fixed (like DeprecationWarning filters that
weren't specifying the full import part, etc.).  Also did a general
code cleanup to remove all "from test.test_support import *"'s.  Other
from...import *'s weren't changed.
2002-07-30 23:27:12 +00:00
Thomas Heller 3e1c18ad0c Fix SF 588452: debug build crashes on marshal.dumps([128] * 1000).
See there for a description.

Added test case.

Bugfix candidate for 2.2.x, not sure about previous versions:
probably low priority, because virtually no one runs debug builds.
2002-07-30 11:40:57 +00:00
Michael W. Hudson 56796f672f Fix for
[ 587875 ] crash on deleting extended slice

The array code got simpler, always a good thing!
2002-07-29 14:35:04 +00:00
Martin v. Löwis b9e0764d8b Revert #571603 since it is ok to import codecs that are not subdirectories
of encodings. Skip modules that don't have a getregentry function.
2002-07-29 14:05:24 +00:00
Thomas Heller f4ad4ce5a0 Recompiled the exe and updated bdist_wininst.py. 2002-07-29 12:11:18 +00:00
Guido van Rossum ad9eba7a69 Add 'engine' back. IDLE used this, others might have copied it from
there.
2002-07-28 19:04:07 +00:00
Martin v. Löwis 301b1cd107 Patch #586999: Fix multiline string in sendmail example. 2002-07-28 16:52:01 +00:00
Neal Norwitz 88fe4ff5a9 Fix the problem of not raising a TypeError exception when doing:
'%g' % '1'
    '%d' % '1'

Add a test for these conditions
Fix the test so that if not exception is raise, this is a failure
2002-07-28 16:44:23 +00:00
Martin v. Löwis fc4c24c142 Patch #571603: Refer to encodings package explicitly. 2002-07-28 11:31:33 +00:00
Martin v. Löwis e567114e47 Patch #543498: Use License: field instead of Copyright:. 2002-07-28 10:49:37 +00:00
Martin v. Löwis 6c611fae53 Patch #581705: Catch OSError, termios.error in spawn. 2.2 bugfix candidate. 2002-07-28 09:42:57 +00:00
Kurt B. Kaiser d694c1faf9 Reset the Python execution server environment to its initial value prior
to executing Run/F5 from an EditorWindow.

M ScriptBinding.py : add call to clear_the_environment()
M run.py           : implemented Executive.clear_the_environment()
2002-07-28 03:35:31 +00:00
Piers Lauder 139bccb2f0 remove redundant import 2002-07-27 07:10:14 +00:00
Piers Lauder 8b6bb4f743 remove redundant code 2002-07-27 07:08:38 +00:00
Piers Lauder 385a77acad remove o/s dependancy from test 2002-07-27 00:38:30 +00:00
Jack Jansen f03c692357 Use os.environ.get() in stead of os.getenv() (which is platform-dependent). 2002-07-26 11:34:49 +00:00
Jack Jansen aeb6a60e03 Reorganized so the test is skipped if os.popen() doesn't exist (in stead of failing). 2002-07-26 11:33:49 +00:00
Kurt B. Kaiser b417936d40 Reverse the RPC socket connection: Python execution server connects to
Idle client and localhost origin of connection is verified by client.
M PyShell.py
M rpc.py
M run.py
2002-07-26 00:06:42 +00:00
Fred Drake fd83374fe2 Remove duplicate checks of the Node.allnodes variable. 2002-07-25 20:40:28 +00:00
Fred Drake e80c0d3580 Add an XXX comment and a pointer to a full bug report. 2002-07-25 20:13:03 +00:00
Skip Montanaro 186bec2f8d typo 2002-07-25 16:10:38 +00:00
Jeremy Hylton c075e197d6 Extended socket.htonl and ntohl to accept longs.
Fixes SF bug #568322.

The code should raise an OverflowError if the long is > 32 bits, even
on platforms where sizeof(long) > 4.
2002-07-25 16:01:12 +00:00
Jeremy Hylton b8a690d42a Remove test that was none too picky about whether attributes exist. 2002-07-25 15:37:23 +00:00
Barry Warsaw 9e4e050c59 Use full package paths in imports. 2002-07-23 20:35:58 +00:00
Barry Warsaw 10d0d595e0 Added a couple of more tests for Header charset handling. 2002-07-23 19:46:35 +00:00
Barry Warsaw b5da606dfd Oops, missed an import of test_support. 2002-07-23 19:23:22 +00:00
Barry Warsaw 1bfab7bc01 A few updates about how/where to import test_support from. 2002-07-23 19:13:45 +00:00
Barry Warsaw 04f357cffe Get rid of relative imports in all unittests. Now anything that
imports e.g. test_support must do so using an absolute package name
such as "import test.test_support" or "from test import test_support".

This also updates the README in Lib/test, and gets rid of the
duplicate data dirctory in Lib/test/data (replaced by
Lib/email/test/data).

Now Tim and Jack can have at it. :)
2002-07-23 19:04:11 +00:00
Barry Warsaw 92825a9a52 append(): Bite the bullet and let charset be the string name of a
character set, which we'll convert to a Charset instance.  Sigh.
2002-07-23 06:08:10 +00:00
Barry Warsaw 15d3739446 make_header(): Watch out for charset is None, which decode_header()
will return as the charset if implicit us-ascii is used.
2002-07-23 04:29:54 +00:00
Neal Norwitz 58b63bf4e3 SF patch #581396, Canvas "select_item" always returns None
Return the selected item, if there is any.
2002-07-23 02:52:58 +00:00
Tim Peters 7ea39b135a New test "+sort", tacking 10 random floats on to the end of a sorted
array.  Our samplesort special-cases the snot out of this, running about
12x faster than *sort.  The experimental mergesort runs it about 8x
faster than *sort without special-casing, but should really do better
than that (when merging runs of different lengths, right now it only
does something clever about finding where the second run begins in
the first and where the first run ends in the second, and that's more
of a temp-memory optimization).
2002-07-21 17:37:03 +00:00
Tim Peters 53d019cf5a Changed import from
from test.test_support import TestSkipped, run_unittest
to
    from test_support import TestSkipped, run_unittest

Otherwise, if the Japanese codecs aren't installed, regrtest doesn't
believe the TestSkipped exception raised by this test matches the

    except (ImportError, test_support.TestSkipped), msg:

it's looking for, and reports the skip as a crash failure instead of
as a skipped test.

I suppose this will make it harder to run this test outside of
regrtest, but under the assumption only Barry does that, better to
make it skip cleanly for everyone else.
2002-07-21 06:06:30 +00:00
Kurt B. Kaiser 1bf4c2d2c9 Bug: clearing the shell undo list after a prompt was allowing files to be
opened on top of the shell instead of in a new window.
2002-07-21 01:24:28 +00:00
Neal Norwitz d69030db4f Get popen test to work even if python is not in the path 2002-07-20 20:35:13 +00:00
Tim Peters 0a30e648e0 Added new test "3sort". This is sorted data but with 3 random exchanges.
It's a little better than average for our sort.
2002-07-20 04:21:51 +00:00
Guido van Rossum 65692578b7 Move the setting of os.environ['LANGUAGE'] to setup(), and reset it to
'en' in teardown().  This way hopefully test_time.py won't fail.
2002-07-20 00:36:38 +00:00
Barry Warsaw d33d47401d Shut the test up and add a missing import 2002-07-19 22:44:23 +00:00
Barry Warsaw 190390b026 The email package's tests live much better in a subpackage
(i.e. email.test), so move the guts of them here from Lib/test.  The
latter directory will retain stubs to run the email.test tests using
Python's standard regression test.

test_email_torture.py is a torture tester which will not run under
Python's test suite because I don't want to commit megs of data to
that project (it will fail cleanly there).  When run under the mimelib
project it'll stress test the package with megs of message samples
collected from various locations in the wild.
2002-07-19 22:31:10 +00:00
Barry Warsaw 629038093c The email package's tests live much better in a subpackage
(i.e. email.test), so move the guts of them here from Lib/test.  The
latter directory will retain stubs to run the email.test tests using
Python's standard regression test.

test_email_torture.py is a torture tester which will not run under
Python's test suite because I don't want to commit megs of data to
that project (it will fail cleanly there).  When run under the mimelib
project it'll stress test the package with megs of message samples
collected from various locations in the wild.

email/test/data is a copy of Lib/test/data.  The fate of the latter is
still undecided.
2002-07-19 22:29:49 +00:00
Barry Warsaw d8e8e54c2b message_from_string(), message_from_file(): The consensus on the
mimelib-devel list is that non-strict parsing should be the default.
Make it so.
2002-07-19 22:26:01 +00:00
Barry Warsaw bb26b4530b Parser.__init__(): The consensus on the mimelib-devel list is that
non-strict parsing should be the default.  Make it so.
2002-07-19 22:25:34 +00:00
Barry Warsaw c10686426e To better support default content types, fix an API wart, and preserve
backwards compatibility, we're silently deprecating get_type(),
get_subtype() and get_main_type().  We may eventually noisily
deprecate these.  For now, we'll just fix a bug in the splitting of
the main and subtypes.

get_content_type(), get_content_maintype(), get_content_subtype(): New
methods which replace the above.  These /always/ return a content type
string and do not take a failobj, because an email message always at
least has a default content type.

set_default_type(): Someday there may be additional default content
types, so don't hard code an assertion about the value of the ctype
argument.
2002-07-19 22:24:55 +00:00
Barry Warsaw d43857455e _structure(): Take an optional `fp' argument which would be the object
to print>> the structure to.  Defaults to sys.stdout.
2002-07-19 22:21:47 +00:00
Barry Warsaw 1cecdc6bcb _dispatch(): Use the new Message.get_content_type() method as hashed
out on the mimelib-devel list.
2002-07-19 22:21:02 +00:00
Fred Drake c441f7b3a6 Follow PyXML: Remove all prints from successful tests. This means we can
also drop the output file.
2002-07-19 22:16:41 +00:00
Guido van Rossum 246a58a10b Remove a few lines that aren't used and cause problems on platforms
where recvfrom() on a TCP stream returns None for the address.
This should address the remaining problems on FreeBSD.
2002-07-19 19:23:54 +00:00
Guido van Rossum 00efe7e798 Pure Python strptime implementation by Brett Cannon. See SF patch 474274.
Also adds tests.
2002-07-19 17:04:46 +00:00
Michael W. Hudson f0d777c56b A few days ago, Guido said (in the thread "[Python-Dev] Python
version of PySlice_GetIndicesEx"):

> OK.  Michael, if you want to check in indices(), go ahead.

Then I did what was needed, but didn't check it in.  Here it is.
2002-07-19 15:47:06 +00:00
Guido van Rossum b6cc7d2806 Add test for previous core dump when sending on closed socket with
timeout.

Added small sleeps to _testAccept() and _testRecv() in
NonBlockingTCPTests, to reduce race conditions (I know, this is not
the solution!)
2002-07-19 12:46:46 +00:00
Barry Warsaw 7aeac9180e Anthony Baxter's cleanup patch. Python project SF patch # 583190,
quoting:

  in non-strict mode, messages don't require a blank line at the end
  with a missing end-terminator. A single newline is sufficient now.

  Handle trailing whitespace at the end of a boundary. Had to switch
  from using string.split() to re.split()

  Handle whitespace on the end of a parameter list for Content-type.

  Handle whitespace on the end of a plain content-type header.

Specifically,

get_type(): Strip the content type string.

_get_params_preserve(): Strip the parameter names and values on both
sides.

_parsebody(): Lots of changes as described above, with some stylistic
changes by Barry (who hopefully didn't screw things up ;).
2002-07-18 23:09:09 +00:00
Barry Warsaw 2d2fc229a0 Anthony Baxter's patch to expose the parser's `strict' flag in these
convenience functions.  Closes SF # 583188 (python project).
2002-07-18 21:29:17 +00:00
Guido van Rossum 0d7b8bc772 Add clarifying comment. 2002-07-18 19:48:46 +00:00
Fred Drake 0d7e68adf2 Script to run the pystones "benchmark" under HotShot. 2002-07-18 19:47:05 +00:00
Fred Drake fbe3608290 Simplify; the low-level log reader is now always a modern iterator,
and should never return None.  (It only did this for an old version of
HotShot that was trying to still work with a patched Python 2.1.)
2002-07-18 19:20:23 +00:00
Fred Drake 302e2bb81b Expose the fileno() method of the underlying profiler. 2002-07-18 19:17:54 +00:00
Fred Drake 7d17e6f3d0 Expose the fileno() method of the underlying log reader.
Remove the crufty support for Python's that don't have StopIteration;
the HotShot patch for Python 2.1 has not been maintained.
2002-07-18 19:17:20 +00:00
Guido van Rossum 9d0c8cee66 Add default timeout functionality. This adds setdefaulttimeout() and
getdefaulttimeout() functions to the socket and _socket modules, and
appropriate tests.
2002-07-18 17:08:35 +00:00
Tim Peters 8b6ec79b74 Gave this a facelift: "/" vs "//", whrandom vs random, etc. Boosted
the default range to end at 2**20 (machines are much faster now).
Fixed what was quite a arguably a bug, explaining an old mystery:  the
"!sort" case here contructs what *was* a quadratic-time disaster for
the old quicksort implementation.  But under the current samplesort, it
always ran much faster than *sort (the random case).  This never made
sense.  Turns out it was because !sort was sorting an integer array,
while all the other cases sort floats; and comparing ints goes much
quicker than comparing floats in Python.  After changing !sort to chew
on floats instead, it's now slower than the random sort case, which
makes more sense (but is just a few percent slower; samplesort is
massively less sensitive to "bad patterns" than quicksort).
2002-07-18 15:53:32 +00:00
Tim Peters 30d4896511 Gave hotshot.LogReader a close() method, to allow users to close the
file object that LogReader opens.  Used it then in test_hotshot; the
test passes again on Windows.  Thank Guido for the analysis.
2002-07-18 14:54:28 +00:00
Guido van Rossum 32616cf8ec We're no longer trying to support older Python versions with this
codebase, so get rid of the pre-2.2 contingency.
2002-07-18 14:33:14 +00:00
Tim Peters ba8c069eb9 test_hotshot fails on Windows now. Added XXX comment explaining why,
and that I don't know how to fix it.  Fred?
2002-07-17 23:52:58 +00:00
Guido van Rossum 7fadcabdee Add a test for the 'closed' attribute on the C-profiler object. 2002-07-17 16:12:53 +00:00
Jeremy Hylton ed375e18d1 Add missing comma. 2002-07-17 15:56:55 +00:00
Guido van Rossum 11c3f0999f Add a rather generous set of tests allowed to be skipped on sunos5. 2002-07-17 15:08:24 +00:00
Tim Peters c7b6bedecf Use sys.executable to run Python, as suggested by Neal Norwitz. 2002-07-17 00:34:26 +00:00
Guido van Rossum 674eae65ea Bunch of tests to make sure that StopIteration is a sink state. 2002-07-16 21:48:11 +00:00
Jeremy Hylton e3252ec6cf Fix typos and such caught by the pycheckerbot. 2002-07-16 21:41:43 +00:00
Tim Peters c411dbaeee Whitespace normalization. 2002-07-16 21:35:23 +00:00
Jeremy Hylton 8531b1b28d Send HTTP requests with a single send() call instead of many.
The implementation now stores all the lines of the request in a buffer
and makes a single send() call when the request is finished,
specifically when endheaders() is called.

This appears to improve performance.  The old code called send() for
each line.  The sends are all short, so they caused bad interactions
with the Nagle algorithm and delayed acknowledgements.  In simple
tests, the second packet was delayed by 100s of ms.  The second send was
delayed by the Nagle algorithm, waiting for the ack.  The delayed ack
strategy delays the ack in hopes of piggybacking it on a data packet,
but the server won't send any data until it receives the complete
request.

This change minimizes the problem that Nagle + delayed ack will cause
a problem, although a request large enough to be broken into two
packets will still suffer some delay.  Luckily the MSS is large enough
to accomodate most single packets.

XXX Bug fix candidate?
2002-07-16 21:21:11 +00:00
Jeremy Hylton 39c6116483 Given the persistent id code a shot at a class before calling save_global().
Some persistent picklers (well, probably, the *only* persistent
pickler) would like to pickle some classes in a special way.
2002-07-16 19:47:43 +00:00
Tim Peters 012b69cb30 The atexit module effectively turned itself off if sys.exitfunc already
existed at the time atexit first got imported.  That's a bug, and this
fixes it.

Also reworked test_atexit.py to test for this too, and to stop using
an "expected output" file, and to test what actually happens at exit
instead of just simulating what it thinks atexit will do at exit.

Bugfix candidate, but it's messy so I'll backport to 2.2 myself.
2002-07-16 19:30:59 +00:00
Andrew MacIntyre 754140e163 Tim_one's change to aggressively overallocate nodes when adding child
nodes (in Parser/node.c) resolves the gross memory consumption
exhibited by the EMX runtime on OS/2, so the test should be exercised
on this platform.
2002-07-15 12:03:19 +00:00
Jeremy Hylton b2622a452a Remove httplib from tested modules.
The test of httplib makes it difficult to maintain httplib.  There are
two many idioms that pyclbr doesn't seem to understand, and I don't
understand how to update these tests to make them work.

Also remove commented out test of urllib2.
2002-07-12 15:54:37 +00:00
Marc-André Lemburg a83ffa89f2 Palm OS encoding from Sjoerd Mullender 2002-07-12 14:36:22 +00:00
Jeremy Hylton 39c03808c7 Change _begin() back to begin().
Client code could create responses explicitly.
2002-07-12 14:04:09 +00:00
Guido van Rossum 08454596d1 Fix SF bug 579701 (Fernando Pérez); an input line consisting of one or
more spaces only crashed pdb.

While I was at it, cleaned up some style nits (spaces between function
and parenthesis, and redundant parentheses in if statement).
2002-07-12 13:10:53 +00:00
Michael W. Hudson 6b7d69d9b4 Well, Fred never did explain why the code to determine whether the
calling Python was installed was so complicated, so I simplified it.

This should get the snake-farm's build scripts working again.
2002-07-12 09:16:44 +00:00
Barry Warsaw 4ef1c7d85b _structure(): Don't get the whole Content-Type: header, just get the
type with get_type().
2002-07-11 20:24:36 +00:00
Tim Peters c62b95e550 test_trashcan() and supporting class Ouch(): Jeremy noted that this test
takes much longer to run in the context of the test suite than when run in
isolation.  That's because it forces a large number of full collections,
which take time proportional to the total number of gc'ed objects in the
whole system.

But since the dangerous implementation trickery that caused this test to
fail in 2.0, 2.1 and 2.2 doesn't exist in 2.3 anymore (the trashcan
mechanism stopped doing evil things when the possibility for compiling
without cyclic gc was taken away), such an expensive test is no longer
justified.  This checkin leaves the test intact, but fiddles the
constants to reduce the runtime by about a factor of 5.
2002-07-11 19:07:45 +00:00
Barry Warsaw f488b2c6d5 _dispatch(): Comment improvements. 2002-07-11 18:48:40 +00:00
Tim Peters 72351b9649 subtype_resurrection(): Removed unused import. 2002-07-11 18:39:56 +00:00
Jeremy Hylton df3f793516 Extend function() to support an optional closure argument.
Also, simplify some ref counting for other optional arguments.
2002-07-11 18:30:27 +00:00
Tim Peters 14cb1e1eff subtype_resurrection(): The test suite with -l properly reported the
immortal object here as a leak.  Made the object mortal again at the end.
2002-07-11 18:26:21 +00:00
Tim Peters 45228ca827 Repaired optimistic comment in new test. 2002-07-11 07:09:42 +00:00
Tim Peters 2484aaea15 Added a test that provokes the hypothesized (in my last checkin comment)
debug-build failure when an instance of a new-style class is resurrected
by a __del__ method -- we simply never had any code that tried this.

This is already fixed in 2.3 CVS.  In 2.2.1, it blows up via

    Fatal Python error: GC object already in linked list

I'll fix it in 2.2.1 CVS next.
2002-07-11 06:56:07 +00:00
Kurt B. Kaiser dc1e70987f 1. Prevent Undo before IOmark in PyShell.PyShell
2. Consolidate Undo code in EditorWindow.EditorWindow
3. Remove Formatting and Run menus from PyShell
2002-07-11 04:33:41 +00:00
Tim Peters 5e5ca56476 assertHasattr(): Made failure msg better than useless.
test_others():  httplib failed in two new ways.  Blame Thumb Boy <wink>.
2002-07-10 02:37:21 +00:00
Jeremy Hylton 29d27ac4fe Fix for SF bug 579107.
The recent SSL changes resulted in important, but subtle changes to
close() semantics.  Since builtin socket makefile() is not called for
SSL connections, we don't get separately closeable fds for connection
and response.  Comments in the code explain how to restore makefile
semantics.

Bug fix candidate.
2002-07-09 21:22:36 +00:00
Barry Warsaw c53b29e2a7 ndiffAssertEqual(): Stringify the arguments before running
.splitlines() on them, since they may be Header instances.

test_multilingual(), test_header_ctor_default_args(): New tests of
make_header() and that Header can take all default arguments.
2002-07-09 16:36:36 +00:00
Barry Warsaw 8da39aa56a make_header(): New function to take the output of decode_header() and
create a Header instance.  Closes feature request #539481.

Header.__init__(): Allow the initial string to be omitted.

__eq__(), __ne__(): Support rich comparisons for equality of Header
instances withy Header instances or strings.

Also, update a bunch of docstrings.
2002-07-09 16:33:47 +00:00
Thomas Heller 6b17abf6c0 Fix SF Bug 564931: compile() traceback must include filename. 2002-07-09 09:23:27 +00:00
Barry Warsaw f6caeba03a Anthony Baxter's patch for non-strict parsing. This adds a `strict'
argument to the constructor -- defaulting to true -- which is
different than Anthony's approach of using global state.

parse(), parsestr(): Grow a `headersonly' argument which stops parsing
once the header block has been seen, i.e. it does /not/ parse or even
read the body of the message.  This is used for parsing message/rfc822
type messages.

We need test cases for the non-strict parsing.  Anthony will supply
these.

_parsebody(): We can get rid of the isdigest end-of-line kludges,
although we still need to know if we're parsing a multipart/digest so
we can set the default type accordingly.
2002-07-09 02:50:02 +00:00
Barry Warsaw a0c8b9d4d5 Add the concept of a "default type". Normally the default type is
text/plain but the RFCs state that inside a multipart/digest, the
default type is message/rfc822.  To preserve idempotency, we need a
separate place to define the default type than the Content-Type:
header.

get_default_type(), set_default_type(): Accessor and mutator methods
for the default type.
2002-07-09 02:46:12 +00:00
Barry Warsaw bb493a7039 __init__(): Don't attach the subparts if its an empty tuple. If the
boundary was given in the arguments, call set_boundary().
2002-07-09 02:44:26 +00:00
Barry Warsaw 93c40f0c3a clone(): A new method for creating a clone of this generator (for
recursive generation).

_dispatch(): If the message object doesn't have a Content-Type:
header, check its default type instead of assuming it's text/plain.
This makes for correct generation of message/rfc822 containers.

_handle_multipart(): We can get rid of the isdigest kludge.  Just
print the message as normal and everything will work out correctly.

_handle_mulitpart_digest(): We don't need this anymore either.
2002-07-09 02:43:47 +00:00
Barry Warsaw ed53bdb02d __init__(): Be sure to set the default type to message/rfc822. 2002-07-09 02:40:35 +00:00
Barry Warsaw 8fa06b55f6 _structure(): A handy little debugging aid that I don't (yet) intend
to make public, but that others might still find useful.
2002-07-09 02:39:07 +00:00
Barry Warsaw 329d3af443 TestEmailBase.ndiffAssertEqual(): Python 2.1's difflib doesn't have an
ndiff function, so just alias it to assertEqual in that case.

Various: make sure all openfile()/read()'s are wrapped in
try/finally's so the file gets closed.

A bunch of new tests checking the corner cases for multipart/digest
and message/rfc822.
2002-07-09 02:38:24 +00:00
Barry Warsaw e5270aea23 New files which test the corners of multipart/message and
message/rfc822 compliance.
2002-07-09 02:36:10 +00:00
Barry Warsaw 27b168ca7c With the addition of Oleg's support for RFC 2231, it's time to bump
the version number to 2.1.
2002-07-09 02:13:10 +00:00
Fred Drake e6691efa0f Change the "__ private" names to "_ protected"; this has been a pain for
subclassing so many times it should simply be changed.
2002-07-08 12:28:06 +00:00
Jack Jansen 1695bcb848 Got rid of special case for Macintosh realloc slowdown: Tim fixed the problem. 2002-07-08 10:07:25 +00:00
Jeremy Hylton 144dea3e05 Fix from SF patch #527518: proxy config with user+pass authentication.
Bug fix candidate.
2002-07-07 16:57:35 +00:00
Jeremy Hylton 6d0a4c79cf Fix for SF bug #432621: httplib: multiple Set-Cookie headers
If multiple header fields with the same name occur, they are combined
according to the rules in RFC 2616 sec 4.2:

Appending each subsequent field-value to the first, each separated by
a comma. The order in which header fields with the same field-name are
received is significant to the interpretation of the combined field
value.
2002-07-07 16:51:37 +00:00
Jeremy Hylton 12f4f35f6e Fix SF bug #575360
Subclasses of Exception that define an __init__ must call
Exception.__init__ or define self.args.  Otherwise, str() will fail.

Bug fix candidate.
2002-07-06 18:55:01 +00:00
Jeremy Hylton d46aa37d35 Handle HTTP/0.9 responses.
Section 19.6 of RFC 2616 (HTTP/1.1):

   It is beyond the scope of a protocol specification to mandate
   compliance with previous versions. HTTP/1.1 was deliberately
   designed, however, to make supporting previous versions easy....

   And we would expect HTTP/1.1 clients to:

      - recognize the format of the Status-Line for HTTP/1.0 and 1.1
        responses;

      - understand any valid response in the format of HTTP/0.9, 1.0, or
        1.1.

The changes to the code do handle response in the format of HTTP/0.9.
Some users may consider this a bug because all responses with a
sufficiently corrupted status line will look like an HTTP/0.9
response.  These users can pass strict=1 to the HTTP constructors to
get a BadStatusLine exception instead.

While this is a new feature of sorts, it enhances the robustness of
the code (be tolerant in what you accept).  Thus, I consider it a bug
fix candidate.

XXX strict needs to be documented.
2002-07-06 18:48:07 +00:00
Kurt B. Kaiser 889f8bf259 Modifying EditorWindow causes breakpoints in that module to be removed
from both sides of the split debugger.
M Debugger.py
M EditorWindow.py
2002-07-06 04:22:25 +00:00
Kurt B. Kaiser 491892b25e Decent burial for venerated ancestor (urn in attic) 2002-07-06 01:20:51 +00:00
Kurt B. Kaiser 1d5cec4fd2 Remove dead code. 2002-07-06 01:07:15 +00:00
Kurt B. Kaiser a3436d253c 1. Test Sourceforge checkin, idle-dev posting
2. Remove extraneous comment
2002-07-06 00:51:33 +00:00
unknown ed813bff29 Combine OldStackViewer.py with Debugger.py, removing dead code.
M Debugger.py       : Incorporate StackViewer, NamespaceViewer classes
M StackViewer.py    : remove import OldStackViewer
U OldStackViewer.py : remove file
2002-07-05 22:05:24 +00:00
Tim Peters ba78bc4a32 printlist(): Replaced the guts with a call to textwrap. Yay! 2002-07-04 19:45:06 +00:00
Greg Ward e807e571a1 Docstring improvements. In particular, added docstrings for the
standalone wrap() and fill() functions.  This should address the
misunderstanding that led to SF bug 577106.
2002-07-04 14:51:49 +00:00
Barry Warsaw 6ee7156996 append(): Clarify the expected type of charset. 2002-07-03 05:04:04 +00:00
Kurt B. Kaiser f50d0f96a2 Debugger Exception Info and GUI Stack Exception Traceback: finish
implementation.
2002-07-03 03:55:43 +00:00
Fred Drake cadb9eb8f6 Be consistent with the functions in the posix/nt module: docstrings
don't include a " -> None" for functions that have no return value.
2002-07-02 21:28:04 +00:00
Jeremy Hylton fbd79944a8 Convert raise to call exception class. Add whitespace. 2002-07-02 20:19:08 +00:00
Fred Drake 8e8dc419d0 Remove bogus assignment to self.length in NamedNodeMap.__delitem__(). 2002-07-02 17:27:06 +00:00
Martin v. Löwis adfa7409f8 Bump required PyXML version to 0.6.5. 2002-06-30 15:08:22 +00:00
Martin v. Löwis 7d650ca83b Implement the encoding argument for toxml and toprettyxml.
Document toprettyxml.
2002-06-30 15:05:00 +00:00
Martin v. Löwis 2ebfd09e58 Merge from PyXML:
[1.3] Added documentation of the namespace URI for elements with no namespace.
[1.4] New property http://www.python.org/sax/properties/encoding.
[1.5] Support optional string interning in pyexpat.
2002-06-30 07:38:50 +00:00
Martin v. Löwis 0e2d881406 Add xml namespace initially (PyXML 1.19). 2002-06-30 07:32:56 +00:00
Martin v. Löwis d1b516c274 Fix spacing. 2002-06-30 07:27:30 +00:00
Martin v. Löwis 18476a3740 Merge changes from PyXML:
[1.15]
Added understanding of the feature_validation, feature_external_pes,
and feature_string_interning features.
Added support for the feature_external_ges feature.
Added support for the property_xml_string property.
[1.16]
Made it recognize the namespace prefixes feature.
[1.17]
removed erroneous first line
[1.19]
Support optional string interning in pyexpat.
[1.21]
Restore compatibility with versions of Python that did not support weak
references.  These do not get the cyclic reference fix, but they will
continue to work as they did before.
[1.22]
Activate entity processing unless standalone.
2002-06-30 07:21:24 +00:00
Raymond Hettinger 46ac8eb3c8 Code modernization. Replace v=s[i]; del s[i] with single lookup v=s.pop(i) 2002-06-30 03:39:14 +00:00
Barry Warsaw 1969817486 Another test of long headers. 2002-06-29 15:23:39 +00:00
Barry Warsaw 9546e7972c Oleg Broytmann's support for RFC 2231 encoded parameters, SF patch #549133
New test cases.
2002-06-29 05:58:45 +00:00
Barry Warsaw 12566a8826 Oleg Broytmann's support for RFC 2231 encoded parameters, SF patch #549133
Specifically,

decode_rfc2231(), encode_rfc2231(): Functions to encode and decode RFC
2231 style parameters.

decode_params(): Function to decode a list of parameters.
2002-06-29 05:58:04 +00:00
Barry Warsaw 908dc4bea8 Oleg Broytmann's support for RFC 2231 encoded parameters, SF patch #549133
Specifically,

_formatparam(): Teach this about encoded `param' arguments, which are
a 3-tuple of items (charset, language, value).  language is ignored.

_unquotevalue(): Handle both 3-tuple RFC 2231 values and unencoded
values.

_get_params_preserve(): Decode the parameters before returning them.

get_params(), get_param(): Use _unquotevalue().

get_filename(), get_boundary(): Teach these about encoded (3-tuple)
parameters.
2002-06-29 05:56:15 +00:00
Barry Warsaw 3fdc889e76 test_multilingual(): Test for Header.__unicode__(). 2002-06-29 03:27:27 +00:00
Barry Warsaw 8e69bdac33 __unicode__(): Patch # 541263 by Mikhail Zabaluev, implementation
modified by Barry.
2002-06-29 03:26:58 +00:00
Jeremy Hylton 566fe9ef66 Track change of begin() to _begin(). 2002-06-28 23:54:30 +00:00
Barry Warsaw b6a9213930 Lots of new and updated tests to check for proper ascii header
folding.  Note that some of the Japanese tests have changed, but I
don't really know if they are correct or not. :(

Someone with Japanese and RFC 2047 expertise, please take a look!
2002-06-28 23:49:33 +00:00
Barry Warsaw ba2577b7f1 _max_append(): When adding the string `s' to its own line, it should
be lstrip'd so that old continuation whitespace is replaced by that
specified in Header's continuation_ws parameter.
2002-06-28 23:48:23 +00:00
Barry Warsaw 766125080f Teach this class about "highest-level syntactic breaks" but only for
headers with no charset or 'us-ascii' charsets.  Actually this is only
partially true: we know about semicolons (but not true parameters) and
we know about whitespace (but not technically folding whitespace).
Still it should be good enough for all practical purposes.

Other changes include:

__init__(): Add a continuation_ws argument, which defaults to a single
space.  Set this to change the whitespace used for continuation lines
when a header must be split.  Also, changed the way header line
lengths are calculated, so that they take into account continuation_ws
(when tabs-expanded) and any provided header_name parameter.  This
should do much better on returning split headers for which the first
and subsequent lines must fit into a specified width.

guess_maxlinelen(): Removed.  I don't think we need this method as
part of the public API.

encode_chunks() -> _encode_chunks(): I don't think we need this one as
part of the public API either.
2002-06-28 23:46:53 +00:00
Barry Warsaw 062749ac57 _split_header(): The code here was terminally broken because it didn't
know anything about RFC 2047 encoded headers.  Fortunately we have a
perfectly good header splitter in Header.encode().  So we just call
that to give us a properly formatted and split header.
Header.encode() didn't know about "highest-level syntactic breaks" but
that's been fixed now too.
2002-06-28 23:41:42 +00:00
Jeremy Hylton 7c75c99a10 Simplify HTTPSConnection constructor.
See discussion in SF bug 458463.
2002-06-28 23:38:14 +00:00
Jeremy Hylton 13f99d7097 Close SF patch 523944: importing modules with foreign newlines.
Didn't use the patch, because universal newlines support made it easy.
It might be worth fixing the actual problem in the 2.2 maintenance
branch, in which case the patch is still needed.
2002-06-28 23:32:51 +00:00
Fred Drake 2a3d7db93e Added character data buffering to pyexpat parser objects.
Setting the buffer_text attribute to true causes the parser to collect
character data, waiting as long as possible to report it to the Python
callback.  This can save an enormous number of callbacks from C to
Python, which can be a substantial performance improvement.

buffer_text defaults to false.
2002-06-28 22:56:48 +00:00
Jeremy Hylton be4fcf1875 Fixes for two separate HTTP/1.1 bugs: 100 responses and HTTPS connections.
The HTTPResponse class now handles 100 continue responses, instead of
choking on them.  It detects them internally in the _begin() method
and ignores them.  Based on a patch by Bob Kline.

This closes SF bugs 498149 and 551273.

The FakeSocket class (for SSL) is now usable with HTTP/1.1
connections.  The old version of the code could not work with
persistent connections, because the makefile() implementation read
until EOF before returning.  If the connection is persistent, the
server sends a response and leaves the connection open.  A client that
reads until EOF will block until the server gives up on the connection
-- more than a minute in my test case.

The problem was fixed by implementing a reasonable makefile().  It
reads data only when it is needed by the layers above it.  It's
implementation uses an internal buffer with a default size of 8192.

Also, rename begin() method of HTTPResponse to _begin() because it
should only be called by the HTTPConnection.
2002-06-28 22:38:01 +00:00
Jack Jansen 2bb598067a The standard definition file is now called mwerks_shcarbon_plugin.h. 2002-06-27 22:10:19 +00:00
Fredrik Lundh 3d9addd55a merged with SLAB codebase (version 1.0.1) 2002-06-27 21:36:21 +00:00
Fredrik Lundh 4fb7027ec0 made the code match the comments (1.5.2 compatibility) 2002-06-27 20:08:25 +00:00
Fredrik Lundh 6f7c3431c8 Fix bug #570057: Broken pre.subn() (and pre.sub())
This should be backported to the 2.2.X series (how
do I do that?)
2002-06-27 19:59:27 +00:00
Fred Drake 1add023b88 Integrate the tests for name interning from PyXML (test_pyexpat.py
revision 1.12 in PyXML).
2002-06-27 19:41:51 +00:00
Neal Norwitz 80a3e0a604 Whitespace normalization (remove tabs) 2002-06-26 22:05:33 +00:00
Jack Jansen ab5320bfd9 Fixed various MacPython-specific issues found by attempting to use the standard core setup.py for MacPython. 2002-06-26 15:42:49 +00:00
Raymond Hettinger 0a2963c797 Apply SF 562987 modernizing Cookie to subclass from dict instead of UserDict 2002-06-26 15:19:01 +00:00
Fred Drake 3a159a8d25 Suppress the variable verbose output from test.xmltests; the inclusion of
timing information in the output makes the determination of success bogus.
2002-06-26 15:16:16 +00:00
Jack Jansen 96cad2ea47 This module broke on the Mac (where it can't work, but distutils seems to import it anyway) because it imported pwd and grp. Moved the import to inside the routine where they're used. 2002-06-26 15:00:29 +00:00
Ka-Ping Yee 711cad769a Also look up variable names in __builtins__ if not found in globals.
Don't show hidden fields of exception values (names starting with '_').
2002-06-26 07:10:56 +00:00
Kurt B. Kaiser ffd3a4217a Shutdown subprocess debugger and associated Proxies/Adapters when closing
the Idle debugger.

M PyShell.py       : Call RemoteDebugger.close_remote_debugger()
M RemoteDebugger.py: Add close_remote_debugger(); further polish code used
                     to start the debugger sections.
M rpc.py           : Add comments on Idlefork methods register(), unregister()
                     comment out unused methods
M run.py           : Add stop_the_debugger(); polish code
2002-06-26 02:32:09 +00:00
Fred Drake 867de944b4 Add convenience module to run all the XML tests. 2002-06-25 19:20:10 +00:00
Kurt B. Kaiser f8096fbba1 Remove all EditorWindow BREAK tags when closing Debugger 2002-06-25 03:28:38 +00:00
Piers Lauder 17031bf421 fix incorrect size calc. in IMAP4_SSL.read 2002-06-24 23:35:37 +00:00
Kurt B. Kaiser 83118c6cb3 Clear associated breakpoints when closing an edit window.
M Debugger.py      : Added clear_file_breaks()
M EditorWindow.py  : Clear breaks when closed, commments->docstrings,
                     comment out some debugging print statements
M PyShell.py       : comments->docstrings ; clarify extending EditorWindow
                     methods.
M RemoteDebugger.py: Add clear_all_file_breaks() functionality,
                     clarify some comments.
2002-06-24 17:03:37 +00:00
Raymond Hettinger ab5dae35ca Fix SF bug 572567: Memory leak in object comparison. 2002-06-24 13:08:16 +00:00
Piers Lauder 0c09293143 Fix IMAP4_SSL read and send methods to take account of short data 2002-06-23 10:47:13 +00:00
Guido van Rossum 10f36d9f0b Add a check that the bug Jeremy just fixed in _PyTuple_Resize() is
fixed.

(Jeremy, how did you discover that?)
2002-06-21 02:14:10 +00:00
Raymond Hettinger 0ae0c07661 SF 569257 -- Name mangle double underscored variable names in __slots__. 2002-06-20 22:23:15 +00:00
Jack Jansen e36a8e8201 Disable the test for importing very long lists for MacPython: it triggers
an out-of-memory condition (and a hang on OSX). Filed a bug report
(#571845) to make sure this is eventually fixed.
2002-06-20 21:34:35 +00:00
Tim Peters 8db890a21a Removed the generator future-stmt -- not needed for 2.3. 2002-06-20 14:52:37 +00:00
Kurt B. Kaiser 669f4c3850 1. Debugger Breakpoints, finish implementation
2. Debugger Clear Breakpoints, implement
3. Nice yellow breakpoints for Chui  :)
2002-06-20 04:01:47 +00:00
Guido van Rossum 3875e90274 I get failures half of the time that I run this, so I'll disable
running this as part of the regular test suite again, until I have
time to figure out why.
2002-06-20 03:40:16 +00:00
Raymond Hettinger 9c051d7e01 SF 570727 indexer() class no longer needed since lists now support slicing 2002-06-20 03:38:12 +00:00
Michael W. Hudson 9c14badc5f Fix the bug described in
http://mail.python.org/pipermail/python-dev/2002-June/025461.html

with test cases.

Also includes extended slice support for arrays, which I thought I'd
already checked in but obviously not.
2002-06-19 15:44:15 +00:00
Jeremy Hylton 2683ac755d Define NDEBUG for releae builds, just like Python.
XXX Why doesn't distutils on Windows use the same set of flags as Python?
2002-06-18 19:08:40 +00:00
Jeremy Hylton 1b046e4314 Add implementation of _compile() and use default compile() method. 2002-06-18 18:48:55 +00:00
Jeremy Hylton 6e08d22b1a Add a default implementation of compile() to the base class.
The default implementation calls _compile() to compile individual
files.  This method must be implemented by the subclass.  This change
factors out most of the remaining common code in all the compilers
except mwerks.
2002-06-18 18:42:41 +00:00
Jeremy Hylton c01b350d36 Only import msvccompiler on win32 platforms. 2002-06-18 18:40:54 +00:00
Guido van Rossum 83ccb4e011 Michael fixed the race conditions and removed the sleeps.
This is his SF patch 569697.  I renamed main() to test_main() again so
that this is run as part of the standard test suite.
2002-06-18 18:35:13 +00:00
Guido van Rossum a96b0df624 Patch from SF bug 570483 (Tim Northover).
In a fresh interpreter, type.mro(tuple) would segfault, because
PyType_Ready() isn't called for tuple yet.  To fix, call
PyType_Ready(type) if type->tp_dict is NULL.
2002-06-18 16:49:45 +00:00
Neal Norwitz 1ed564af8c Whitespace normalization (tabs -> spaces) 2002-06-17 12:43:20 +00:00
Piers Lauder 3fca291a52 Add IMAP4 QUOTA extension methods 2002-06-17 07:07:20 +00:00
Piers Lauder f0a70f6d0a Alter text test arg to obey new rule, also include inverse test to make time-zone independant 2002-06-17 07:06:24 +00:00
Kurt B. Kaiser 0e3a57731b Polish RemoteDebugger code.
Use a repr() on the subprocess side when fetching dict values for stack.
The various dict entities are not needed by the debugger GUI, only
their representation.
2002-06-16 03:32:24 +00:00
Guido van Rossum 94c9d909d5 Forgot to add this. It's part of patch 568629. 2002-06-16 01:22:13 +00:00
Tim Peters 0f1afb1df3 test_module_with_large_stack(): This failed when Python was run with -O,
trying to delete a .pyc file that didn't exist (it needed to delete .pyo
then).
2002-06-15 05:14:05 +00:00
Tim Peters 06727123db test_module_with_large_stack(): This failed on Windows, for the wrong
reason <wink>:  can't unlink an open file on Windows.
2002-06-15 05:00:42 +00:00
Guido van Rossum bea18ccde6 SF patch 568629 by Oren Tirosh: types made callable.
These built-in functions are replaced by their (now callable) type:

    slice()
    buffer()

and these types can also be called (but have no built-in named
function named after them)

    classobj (type name used to be "class")
    code
    function
    instance
    instancemethod (type name used to be "instance method")

The module "new" has been replaced with a small backward compatibility
placeholder in Python.

A large portion of the patch simply removes the new module from
various platform-specific build recipes.  The following binary Mac
project files still have references to it:

    Mac/Build/PythonCore.mcp
    Mac/Build/PythonStandSmall.mcp
    Mac/Build/PythonStandalone.mcp

[I've tweaked the code layout and the doc strings here and there, and
added a comment to types.py about StringTypes vs. basestring.  --Guido]
2002-06-14 20:41:17 +00:00
Guido van Rossum da07ea7282 Use code.interact(), which is even simpler, *and* imports readline
when it can.
2002-06-14 13:54:26 +00:00
Guido van Rossum 2aabac8276 Don't poorly emulate the interactive interpreter, use
code.InteractiveConsole to do a much better job.
2002-06-14 13:48:25 +00:00
Guido van Rossum e7f3e24eeb Test for the bug in recurse_down_subclasses() that I just fixed. 2002-06-14 02:35:45 +00:00
Neal Norwitz 7fdcb41131 Fix SF bug # 561858 Assertion with very long lists
Write 4 bytes for co_stacksize, etc. to prevent writing out
bad .pyc files which can cause a crash when read back in.
2002-06-14 01:07:39 +00:00
Neal Norwitz 1f68fc7fa5 SF bug # 493951 string.{starts,ends}with vs slices
Handle negative indices similar to slices.
2002-06-14 00:50:42 +00:00
Neal Norwitz 1b738e916f Test exceptional condition in select() 2002-06-13 22:23:47 +00:00
Neal Norwitz 6fc36c5491 Test exceptional conditions in list.sort() 2002-06-13 22:23:06 +00:00
Neal Norwitz 2b34290055 Cleanup a little 2002-06-13 22:18:39 +00:00
Guido van Rossum 16b93b3d0e Fix for SF bug 532646. This is a little simpler than what Neal
suggested there, based upon a better analysis (__getattr__ is a red
herring).  Will backport to 2.2.
2002-06-13 21:32:51 +00:00
Guido van Rossum 654c11ee3a Temporarily disable the timeout and socket tests.
They still run as standalone scripts, but when used as part of the
regression test suite, they are effectively no-ops.
(This is done by renaming test_main to main.)
2002-06-13 20:24:17 +00:00
Guido van Rossum 09638c16d8 Hopefully this addresses the remaining issues of SF bugs 459235 and
473985.  Through a subtle rearrangement of some members in the etype
struct (!), mapping methods are now preferred over sequence methods,
which is necessary to support str.__getitem__("hello", slice(4)) etc.
2002-06-13 19:17:46 +00:00
Guido van Rossum fea59e7f76 The opcode FOR_LOOP no longer exists. 2002-06-13 17:59:51 +00:00
Jeremy Hylton c18fde5d82 Extend dependency tracking so that .o files are rebuilt.
Two new tests are needed:

Don't skip building an extension if any of the depends files are newer
than the target.

Pass ext.depends to compiler.compile() so that it can track individual
files.
2002-06-13 17:32:20 +00:00
Jeremy Hylton 1bba31d9a2 Refactor compile() method implementations.
Always use _setup_compile() to do the grunt work of processing
arguments, figuring out which files to compile, and emitting debug
messages for files that are up-to-date.

Use _get_cc_args() when possible.
2002-06-13 17:28:18 +00:00
Jeremy Hylton 6864d30dfe Add depends=None to the arglist for compile(). 2002-06-13 17:27:13 +00:00
Jeremy Hylton 59b103cf87 Extend compiler() method with optional depends argument.
This change is not backwards compatible.  If a compiler subclass
exists outside the distutils package, it may get called with the
unexpected keyword arg.  It's easy to extend that compiler by having
it ignore the argument, and not much harder to do the right thing.  If
this ends up being burdensome, we can change it before 2.3 final to
work harder at compatibility.

Also add _setup_compile() and _get_cc_args() helper functions that
factor out much of the boilerplate for each concrete compiler class.
2002-06-13 17:26:30 +00:00
Guido van Rossum 597257b940 Comment out testHostnameRes() -- it depends on a correctly working
DNS, and we can't assume that.
2002-06-13 16:54:38 +00:00
Guido van Rossum 7b8bac106a Fix non-blocking connect() for Windows. Refactored the code
that retries the connect() call in timeout mode so it can be shared
between connect() and connect_ex(), and needs only a single #ifdef.

The test for this was doing funky stuff I don't approve of,
so I removed it in favor of a simpler test.  This allowed me
to implement a simpler, "purer" form of the timeout retry code.
Hopefully that's enough (if you want to be fancy, use non-blocking
mode and decode the errors yourself, like before).
2002-06-13 16:07:04 +00:00
Jeremy Hylton 129b17d538 More style changes and little cleanups.
Remove __init__ that just called base class __init__ with same args.
Fold long argument lists into fewer, shorter lines.
Remove parens in tuple unpacks.
Don't put multiple statements on one line with a semicolon.
In find_library_file() compute the library_filename() upfront.
2002-06-13 15:14:10 +00:00
Guido van Rossum 11ba094957 Major overhaul of timeout sockets:
- setblocking(0) and settimeout(0) are now equivalent, and ditto for
  setblocking(1) and settimeout(None).

- Don't raise an exception from internal_select(); let the final call
  report the error (this means you will get an EAGAIN error instead of
  an ETIMEDOUT error -- I don't care).

- Move the select to inside the Py_{BEGIN,END}_ALLOW_THREADS brackets,
  so other theads can run (this was a bug in the original code).

- Redid the retry logic in connect() and connect_ex() to avoid masking
  errors.  This probably doesn't work for Windows yet; I'll fix that
  next.  It may also fail on other platforms, depending on what
  retrying a connect does; I need help with this.

- Get rid of the retry logic in accept().  I don't think it was needed
  at all.  But I may be wrong.
2002-06-13 15:07:44 +00:00
Guido van Rossum dfad1a9039 Fix a typo.
Add a sleep (yuck!) to _testRecvFrom() so the server can set up first.
2002-06-13 15:03:01 +00:00
Jeremy Hylton 022640dea0 Some more style improvements 2002-06-13 15:01:38 +00:00
Jeremy Hylton 28f46e1839 Python style conformance: Delete spaces between name of function and arglist.
Making the world better a little bit at a time <wink>.
2002-06-13 14:58:30 +00:00
Guido van Rossum 3fcd45230f Whitespace nit. 2002-06-13 11:53:12 +00:00
Guido van Rossum ab659966db Remove some overly complicated ways to concatenate and repeat strings
using "".join().  Fold a long line.
2002-06-12 21:29:43 +00:00
Guido van Rossum 284a2cf07f Don't test for Java, test for sys.getrefcount. 2002-06-12 21:19:40 +00:00
Guido van Rossum 1c938014a3 Some provisional changes to get more tests to run on Windows (I hope). 2002-06-12 21:17:20 +00:00
Guido van Rossum 8e95ca85ae Argh. Typo. :-( 2002-06-12 20:55:17 +00:00
Guido van Rossum 6fb3d5ee92 Allow absent fromfd(), for Windows. 2002-06-12 20:48:59 +00:00
Guido van Rossum 733632ac1f testSetSockOpt() should not require the reuse flag to be 1 -- any
nonzero value is OK.  Also fixed the error message for this and for
testGetSockOpt().
2002-06-12 20:46:49 +00:00
Guido van Rossum 7648968716 Lose the message on assertEqual calls -- they actually hide
information on what went wrong.
2002-06-12 20:38:30 +00:00
Guido van Rossum 28774da364 Docstring, layout and style tweaking. Increase fuzz to 1 second. 2002-06-12 20:22:49 +00:00
Jeremy Hylton 09e532bcec Add a new definition to Extension objects: depends.
depends is a list of files that the target depends, but aren't direct
sources of the target.  think .h files.
2002-06-12 20:08:56 +00:00
Guido van Rossum aa6a664bbb Add some more basic tests to validate the argument checking of
settimeout(), test settimeout(None), and the interaction between
settimeout() and setblocking().
2002-06-12 19:57:18 +00:00
Guido van Rossum 24e4af8c72 New test suite for the socket module by Michael Gilfix.
Changed test_timeout.py to conform to the guidelines in Lib/test/README.
2002-06-12 19:18:08 +00:00
Guido van Rossum 05e01ee114 Add a testcase to ensure that cycles going through the __class__ link
of a new-style instance are detected by the garbage collector.
2002-06-12 14:38:04 +00:00
Guido van Rossum c5fe5eb8d2 SF bug 567538: Generator can crash the interpreter (Finn Bock).
This was a simple typo.  Strange that the compiler didn't catch it!
Instead of WHY_CONTINUE, two tests used CONTINUE_LOOP, which isn't a
why_code at all, but an opcode; but even though 'why' is declared as
an enum, comparing it to an int is apparently not even worth a
warning -- not in gcc, and not in VC++. :-(

Will fix in 2.2 too.
2002-06-12 03:45:21 +00:00
Kurt B. Kaiser 969de458aa Rework the code to have only the GvR RPC. Output from execution of user
code is directed to the Shell.
2002-06-12 03:28:57 +00:00
Guido van Rossum 9f709bf9a1 The opcode YIELD_STMT was accidentally called YIELD_VALUE here. 2002-06-11 21:17:35 +00:00
Neal Norwitz 60e04cd317 Fix SF #565414, FancyURLopener() needs to support **kwargs
since the URLopener base class does and **kwargs are used in urlopen.
2002-06-11 13:38:51 +00:00
Michael W. Hudson 589dc93620 Fix for problem reported by Neal Norwitz. Tighten up calculation of
slicelength.  Include his test case.
2002-06-11 13:38:42 +00:00
Michael W. Hudson 5efaf7eac8 This is my nearly two year old patch
[ 400998 ] experimental support for extended slicing on lists

somewhat spruced up and better tested than it was when I wrote it.

Includes docs & tests.  The whatsnew section needs expanding, and arrays
should support extended slices -- later.
2002-06-11 10:55:12 +00:00
Martin v. Löwis f90ae20354 Patch #488073: AtheOS port. 2002-06-11 06:22:31 +00:00
Steven M. Gava 7981ce576c add a version of GvR's q&d python idle printing patch,
slightly tweaked and modified for the idlefork config system
2002-06-11 04:45:34 +00:00
Greg Ward 62080bee14 Took initial_tab and subsequent_tab away from the fill() method and
transformed them into the initial_indent and subsequent_indent instance
attributes.  Now they actually work as advertised, ie. they are
accounted for in the width of each output line.  Plus you can use them
with wrap() as well as fill(), and fill() went from simple-and-broken to
trivial-and-working.
2002-06-10 21:37:12 +00:00
Guido van Rossum 11ade1ddc0 SF patch 560794 (Greg Chapman): deepcopy can't handle custom
metaclasses.

This is essentially the same problem as that reported in bug 494904
for pickle: deepcopy should treat instances of custom metaclasses the
same way it treats instances of type 'type'.

Bugfix candidate.
2002-06-10 21:10:27 +00:00
Greg Ward cf02ac6154 Allow the standalone wrap() and fill() functions to take arbitrary
keyword args, which are passed directly to the TextWrapper constructor.
2002-06-10 20:36:07 +00:00
Greg Ward d34c959140 Make 'width' an instance attribute rather than an argument to the wrap()
and fill() methods.  Keep interface of existing wrap() and fill()
functions by going back to having them construct a new TextWrapper
instance on each call, with the preferred width passed to the
constructor.
2002-06-10 20:26:02 +00:00
Guido van Rossum 009afb7c90 SF patch 564549 (Erik Andersén).
The WeakKeyDictionary constructor didn't work when a dict arg was
given.  Fixed by moving a line.  Also adding a unit test.

Bugfix candidate.
2002-06-10 20:00:52 +00:00
Greg Ward 47df99d575 Make all of TextWrapper's options keyword args to the constructor. 2002-06-09 00:22:07 +00:00
Greg Ward 698d9f01c6 Record copyright and author. 2002-06-07 22:40:23 +00:00
Greg Ward 70c726aa44 Use True/False instead of 1/0. 2002-06-07 22:35:41 +00:00
Greg Ward f404c7ee84 Remove islower() -- not used anymore. 2002-06-07 22:33:11 +00:00
Greg Ward cb320eb938 Conform to the bloody coding standards: "def foo()" not "def foo ()".
Yuck.
2002-06-07 22:32:15 +00:00
Greg Ward 9b4864e40a Convert _fix_sentence_endings() to use a regex, and augment it to
handle sentences like this:
  And she said, "Go to hell!"  Can you believe that?
2002-06-07 22:04:15 +00:00
Greg Ward 62e4f3bf22 Add fix_sentence_endings option to control whether we ensure that
sentences are separated by two spaces.

Improve _fix_sentence_endings() a bit -- look for ".!?" instead of just
".", and factor out the list of sentence-ending punctuation characters
to a class attribute.
2002-06-07 21:56:16 +00:00
Greg Ward 0093582489 Initial revision. Currently biased towards English in a fixed-width font,
according to the conventions that I (and Tim Peters) learned in school.
2002-06-07 21:43:37 +00:00
Guido van Rossum 9e9d4f8ed8 Added -t (--threshold) option to call gc.set_threshold(N). 2002-06-07 15:17:03 +00:00
Skip Montanaro 96803b2983 gnu_getopt should be exported in __all__ 2002-06-07 03:26:43 +00:00
Guido van Rossum 67f7a38849 SF patch 555085 (timeout socket implementation) by Michael Gilfix.
I've made considerable changes to Michael's code, specifically to use
the select() system call directly and to store the timeout as a C
double instead of a Python object; internally, -1.0 (or anything
negative) represents the None from the API.

I'm not 100% sure that all corner cases are covered correctly, so
please keep an eye on this.  Next I'm going to try it Windows before
Tim complains.

No way is this a bugfix candidate. :-)
2002-06-06 21:08:16 +00:00
Neal Norwitz a312c3ade7 Remove uses of string module and stat.ST_MODE 2002-06-06 18:30:10 +00:00
Neal Norwitz ec7cf1382b Remove another reference to stat.ST_MODE 2002-06-06 18:16:14 +00:00
Martin v. Löwis 33b77de106 Use isinstance for the type check, use booleans. 2002-06-06 18:14:50 +00:00
Guido van Rossum a48cb8f77d Fix from SF patch 565085: copy._reduction doesn't __setstate__.
Straightforward fix.  Will backport to 2.2.  If there's ever a new 2.1
release, this could be backported there too (since it's an issue with
anything that's got both a __reduce__ and a __setstate__).
2002-06-06 17:53:03 +00:00
Guido van Rossum 3e3583c345 Fix from SF patch 565085: copy._reduction doesn't __setstate__.
Straightforward fix.  Will backport to 2.2.  If there's ever a new 2.1
release, this could be backported there too (since it's an issue with
anything that's got both a __reduce__ and a __setstate__).
2002-06-06 17:41:20 +00:00
Raymond Hettinger 478d47a168 Close SF bug 563740. complex() now finds __complex__() in new style classes.
Made conversion failure error messages consistent between types.
Added related unittests.
2002-06-06 15:45:38 +00:00
Jeremy Hylton a683233d87 Change warning to debug level; it's a very minor issue.
The specific warning is that clean didn't find a directory that should
be removed if it exists.
2002-06-06 14:54:56 +00:00
Martin v. Löwis 446a25fa3c Patch 473512: add GNU style scanning as gnu_getopt. 2002-06-06 10:58:36 +00:00
Martin v. Löwis cdbc131f03 Patch #551911: Escape . properly. 2002-06-06 09:52:49 +00:00
Walter Dörwald 294bbf3a59 Replace obsolete stat module constants with
equivalent attributes in a few more spots.

This closes SF patch http://www.python.org/sf/562373
2002-06-06 09:48:13 +00:00
Raymond Hettinger c4c453f5ae Skip Montanaro's patch, SF 559833, exposing xrange type in builtins.
Also, added more regression tests to cover the new type and test its
conformity with range().
2002-06-05 23:12:45 +00:00
Piers Lauder f97b2d7dad open method changed to use arguments and set instance host/port values (instead of __init__) 2002-06-05 22:31:57 +00:00
Guido van Rossum d842e07470 SF bug 558179.
Change default for get() back to None.
Will backport to 2.2.1.
2002-06-05 19:07:39 +00:00
Jeremy Hylton dc8412e541 Move warning about directory not on sys.path to debug level.
Fix a bunch of multiline string constants that used +.
2002-06-04 21:20:08 +00:00
Jeremy Hylton 8f787bf1d0 Test changes before checking them in. 2002-06-04 21:11:56 +00:00
Jeremy Hylton 40ebbeff23 Track extra arg to option_table to all uses of it 2002-06-04 21:10:35 +00:00
Jeremy Hylton 6b3996b2b9 Replace bogus bare variables with attribute access. 2002-06-04 21:06:16 +00:00
Jeremy Hylton 115fdc614f Define DEBUG as early as possible to avoid import problems. 2002-06-04 21:05:05 +00:00
Jeremy Hylton 4f2f1335a8 Add missing import of log. 2002-06-04 21:04:03 +00:00
Jeremy Hylton 7146073850 Use module-level import of DEBUG instead of many function-level imports. 2002-06-04 21:02:26 +00:00
Jeremy Hylton fc861bab92 Remove unused imports 2002-06-04 21:00:33 +00:00
Jeremy Hylton 11a52708f7 Make None return explicit 2002-06-04 21:00:20 +00:00
Jeremy Hylton c58e984837 import base64 at the top to avoid two different imports at other times 2002-06-04 20:55:10 +00:00
Jeremy Hylton ec772744c7 ensure_filename() only takes one argument.
Call ensure_string() with one arg too, since the second value passed
was the default.
2002-06-04 20:45:17 +00:00
Jeremy Hylton adb2b38543 Reindent lines to improve readability 2002-06-04 20:42:41 +00:00
Jeremy Hylton 711f91cf83 Remove (commented out) options that have moved into the distribution. 2002-06-04 20:40:03 +00:00
Jeremy Hylton d003abccc7 get_script() implicitly returned None and also had explicit returns.
Make all returns explicit and rearrange logic to avoid extra
indentation.
2002-06-04 20:39:34 +00:00