Commit Graph

5644 Commits

Author SHA1 Message Date
Barry Warsaw cd45a36959 formatdate(): The calculation of the minutes part of the zone was
incorrect for "uneven" timezones.  This algorithm should work for even
timezones (e.g. America/New_York) and uneven timezones (e.g.
Australia/Adelaide and America/St_Johns).

Closes SF bug #483231.
2001-11-19 16:28:07 +00:00
Barry Warsaw 7a1bea64f8 test_formatdate(): A test that has a mild hope of working on Mac,
which has a different epoch than *nix.  Jack may need to twiddle the
details.
2001-11-18 23:15:58 +00:00
Fred Drake 5751a22ede Fix parsing of parameters from a URL; urlparse() did not check that it only
split parameters from the last path segment.  Introduces two new functions,
urlsplit() and urlunsplit(), that do the simpler job of splitting the URL
without monkeying around with the parameters field, since that was not being
handled properly.
This closes bug #478038.
2001-11-16 02:52:57 +00:00
Barry Warsaw bf4d959d28 Two changes:
load_inst(): Implement the security hook that cPickle already had.
When unpickling callables which are not classes, we look to see if the
object has an attribute __safe_for_unpickling__.  If this exists and
has a true value, then we can call it to create the unpickled object.
Otherwise we raise an UnpicklingError.

find_class(): We no longer mask ImportError, KeyError, and
AttributeError by transforming them into SystemError.  The latter is
definitely not the right thing to do, so we let the former three
exceptions simply propagate up if they occur, i.e. we remove the
try/except!
2001-11-15 23:42:58 +00:00
Tim Peters 144b98dab8 More simple test cases for mixed classic+new multiple inheritance. 2001-11-14 23:56:45 +00:00
Tim Peters a91e9646e0 Changing diapers reminded Guido that he wanted to allow for some measure
of multiple inheritance from a mix of new- and classic-style classes.
This is his patch, plus a start at some test cases from me.  Will check
in more, plus a NEWS blurb, later tonight.
2001-11-14 23:32:33 +00:00
Tim Peters 00cafa0f76 Removed print that executes only on Unix boxes; that made it impossible
to have single "expected output" file.
2001-11-13 23:39:47 +00:00
Tim Peters 5ebfd36afa CVS patch #477161: New "access" keyword for mmap, from Jay T Miller.
This gives mmap() on Windows the ability to create read-only, write-
through and copy-on-write mmaps.  A new keyword argument is introduced
because the mmap() signatures diverged between Windows and Unix, so
while they (now) both support this functionality, there wasn't a way to
spell it in a common way without introducing a new spelling gimmick.
The old spellings are still accepted, so there isn't a backward-
compatibility issue here.
2001-11-13 23:11:19 +00:00
Jeremy Hylton 79b5b5b7fb Don't munge __debug__ and leave it that way. 2001-11-13 22:03:20 +00:00
Tim Peters 8876848323 Whitespace normalization. 2001-11-13 21:51:26 +00:00
Barry Warsaw 135cce8718 A specific test for bug #481221, getaddrlist() failing on long
addresses.  Commented out because it still takes too long to run.
2001-11-13 21:33:52 +00:00
Barry Warsaw f1fd282f13 Fix for bug #481221, getaddrlist() failing on long addresses. 2001-11-13 21:30:37 +00:00
Barry Warsaw 3ca656f1be Committing the second part of patch #480902, an improved test suite
for dumbdbm.py, by Skip Montanaro.  The first half of Skip's patch has
been postponed until Py2.3 since it adds new features.
2001-11-13 20:16:52 +00:00
Barry Warsaw 19c10caaa4 Add tests for bug #478115, parsedate_tz() IndexError when a Date:
field exists with an empty value.
2001-11-13 18:01:37 +00:00
Barry Warsaw 4a106ee9e1 parsedate_tz(): If data is false, return None. Fixes bug #478115,
IndexError when a Date: field exists with an empty value.
2001-11-13 18:00:40 +00:00
Jack Jansen 92c2ebf1b2 The libraries argument was completely ignored, fixed. Reported by
Tom Loredo.
2001-11-10 23:20:22 +00:00
Barry Warsaw 4279346a9f getnameinfo() appears to raise socket.error instead of
socket.gaierror. :( This allows test_socket to pass on a RH6.1-ish
Linux system.
2001-11-09 20:37:43 +00:00
Jeremy Hylton 8edd5402f0 Fix SF buf #480096: Assign to __debug__ still allowed
Easy enough to catch assignment in the compiler.  The perverse user
can still change the value of __debug__, but that may be the least he
can do.
2001-11-09 20:37:13 +00:00
Jeremy Hylton 778e265462 Fix SF buf #480096: Assign to __debug__ still allowed
Easy enough to catch assignment in the compiler.  The perverse user
can still change the value of __debug__, but that may be the least he
can do.
2001-11-09 19:50:08 +00:00
Jeremy Hylton 734c7fb131 Fiddle with new test cases -- verify that we get a sensible error
message for bad mode argument -- so that it doesn't fail on Windows.

It's hack.  We know that errno is set to 0 in this case on Windows, so
check for that specifically.
2001-11-09 19:34:43 +00:00
Barry Warsaw a4e5c71962 test_formatdate(): Dang. Typo. 2001-11-09 19:31:34 +00:00
Barry Warsaw 7edd71a9f5 test_formatdate(): Don't do the localtime test if we don't have
strptime() -- I'm too lazy to code it otherwise.
2001-11-09 19:30:58 +00:00
Barry Warsaw 75edc6a033 test_formatdate(): A test for email.Utils.formatdate(). 2001-11-09 17:46:17 +00:00
Barry Warsaw 9aa6435398 Forgot to import time. 2001-11-09 17:45:48 +00:00
Barry Warsaw 9cff0e604a formatdate(): A better docstring. 2001-11-09 17:07:28 +00:00
Barry Warsaw aa79f4d492 formatdate(): An implementation to replace the one borrowed from
rfc822.py.  The old rfc822.formatdate() produced date strings using
obsolete syntax.  The new version produces the preferred RFC 2822
dates.

Also, an optional argument `localtime' is added, which if true,
produces a date relative to the local timezone, with daylight savings
time properly taken into account.
2001-11-09 16:59:56 +00:00
Jeremy Hylton 52a17becbc Fix SF bug 468948 & 451295: urllib2 authentication problems
Fix contributed by Jeffrey C. Ollie.

I haven't tested the fix because the situation is non-trivial to
reproduce.

The basic solution is to get rid of the __current_realm attribute of
authentication handlers.  Instead, prevent infinite retries by
checking for the presence of an Authenticate: header in the request
object that exactly matches the Authenticate: header that would be
added.

The problem prevent authentication from working correctly in the
presence of retries.

Ollie mentioned that digest authentication has the same problem and I
applied the same solution there.
2001-11-09 16:46:51 +00:00
Jeremy Hylton 6383c2d1a6 Fix SF bug #479186: compiler generates bad code for "del"
Fix by Neil Schemenauer.  Visit the Subscript node when trying to find
the operation for a statement.

XXX Not sure if there are other nodes that should be visited.
2001-11-09 16:24:34 +00:00
Jeremy Hylton 41c8321252 Fix SF buf #476953: Bad more for opening file gives bad msg.
If fopen() fails with EINVAL it means that the mode argument is
invalid.  Return the mode in the error message instead of the
filename.
2001-11-09 16:17:24 +00:00
Jeremy Hylton 20747fa167 A better new, unique object 2001-11-09 16:15:04 +00:00
Martin v. Löwis bc0ad2d1a4 Merge directory chooser into tkFileDialog. 2001-11-08 17:51:33 +00:00
Fred Drake d5214b04f5 Clean up one comment, fix typos in others. 2001-11-08 17:19:29 +00:00
Martin v. Löwis 25ee87cc50 Patch #478654: Expose tk_chooseDirectory.
Also delegate kw arguments through ** calls.
2001-11-07 22:38:08 +00:00
Fred Drake 752eda459a Add a regression test for SF bug #478536: If a value cannot be weakly
referenced, WeakKeyDictionary.has_key() should return 0 instead of raising
TypeError.
2001-11-06 16:38:34 +00:00
Fred Drake 3bae7ddf8e WeakKeyDictionary.has_key(): If the key being tested is not weakly
referencable (weakref.ref() raises TypeError), return 0 instead of
propogating the TypeError.
This closes SF bug #478536; bugfix candidate.
2001-11-06 16:36:53 +00:00
Tim Peters e5a611c1bc A couple more test cases to ensure join() doesn't add an "extra" backslash
in the presence of empty-string arguments.
2001-11-05 21:33:04 +00:00
Tim Peters 6a3e5f14a6 SF bug 478425: Change in os.path.join (ntpath.py)
ntpath.join('a', '') was producing 'a' instead of 'a\\' as in 2.1.
Impossible to guess what was ever *intended*, but since split('a\\')
produces ('a', ''), I think it's best if join('a', '') gives 'a\\' back.
2001-11-05 21:25:02 +00:00
Barry Warsaw 2a9e3852ee walk(): Fix docstring; traversal is depth-first. Closes mimelib bug
#477864.
2001-11-05 19:19:55 +00:00
Fred Drake 526286725d Add regression test for SF bug #476616 -- make sure copy of a derived class
does not share data with the original.
2001-11-05 17:41:48 +00:00
Fred Drake 3ce5af70e3 copy(): Make sure the copy of a derived class cannot share the data of the
original by replacing self.data temporarily, then using the update() method
on the new mapping object to populate it.
This closes SF bug #476616.
2001-11-05 17:40:48 +00:00
Steven M. Gava d0342cdefa new config implementation 2001-11-04 11:53:10 +00:00
Steven M. Gava 9930061ce2 further config system work 2001-11-04 07:03:08 +00:00
Barry Warsaw ebf5427bfa Two bug fixes for problems reported by Sverre:
__getaddr(): Watch out for empty addresses that can happen when
something like "MAIL FROM:<CR>" is received.  This avoids the
IndexError and rightly returns an SMTP syntax error.

parseargs(): We didn't handle the 2-arg case where both the localspec
and the remotespec were provided on the command line.
2001-11-04 03:04:25 +00:00
Tim Peters 7533587d43 Improved error msg when a symbolic group name is redefined. Added docs
and NEWS.  Bugfix candidate?  That's a dilemma for Anthony <wink>:  /F
did fix a longstanding bug here, but the fix can cause code to raise an
exception that previously worked by accident.
2001-11-03 19:35:43 +00:00
Steven M. Gava c034b47ef3 added ability to set hilightthickness 2001-11-03 14:55:47 +00:00
Steven M. Gava 9dd16b3443 further config system work 2001-11-03 14:54:25 +00:00
Steven M. Gava e16d94b77e more work to support new config system 2001-11-03 05:07:28 +00:00
Martin v. Löwis b7b3260128 Patch #471120: Improved doc strings and new wrappers. 2001-11-02 23:48:20 +00:00
Martin v. Löwis 06b1d21e7d Correct getnameinfo refcounting and tuple parsing. Fixes #476648. 2001-11-02 23:34:52 +00:00
Andrew M. Kuchling f792bba98f [Patch #477336] Add an extensive PyUnit based testsuite for the hmac
module
2001-11-02 21:49:59 +00:00
Andrew M. Kuchling 1ccdff90bb [Patch #477336] Make hmac.py match PEP247, and fix the copy method() so that
it works
2001-11-02 21:49:20 +00:00
Andrew M. Kuchling a0b6035a54 [Patch #476612] Add test suite for PEP247 compliance 2001-11-02 21:46:17 +00:00
Andrew M. Kuchling a2085cb7f7 Fix comment typo 2001-11-02 21:45:39 +00:00
Fredrik Lundh 8a0232d84f SF bug #476912: flag repeated use of the same groupname as
the error it really is (and always has been)
2001-11-02 13:59:51 +00:00
Fred Drake 49cc01e552 Brute-force performance hackery; buys back about 20% of the time for
saferepr(), a bit less for pformat().
2001-11-01 17:50:38 +00:00
Chui Tey 8a7b4fa6d2 Documentation patches by bsherwood 2001-10-31 10:40:28 +00:00
Tim Peters 59ed448bc6 SF patch #474485: pydoc generates some bad html, from Rich Salz. 2001-10-31 04:20:26 +00:00
Tim Peters 7e0f81e631 Huh. In an effort to be less thorough <wink>, seems I checked in a new
test that wouldn't even compile,
2001-10-31 03:46:14 +00:00
Tim Peters c2fe618575 Fix bad bug in structseq slicing (NULL pointers in result). Reported by
Jack Jansen on python-dev.
Add simple test case.
Move vereq() from test_descr to test_support (it's handy!).
2001-10-30 23:20:46 +00:00
Jeremy Hylton f24339f6f7 /F observes that we need an else: in connect() 2001-10-30 14:16:17 +00:00
Tim Peters 1633a2e345 Whitespace normalization. 2001-10-30 05:56:40 +00:00
Tim Peters 9e6a399b14 To cover a recent checkin, added a test to ensure dir(None) == dir(Ellipsis). 2001-10-30 05:45:26 +00:00
Tim Peters fe677e2012 Just changed some continued-line indentation to read better, due to
the earlier s/dictionary/dict/ change.
2001-10-30 05:41:07 +00:00
Guido van Rossum fa699126b5 Fix SF bug #456386: test_commands regression failure (Andrew Dalke)
test_commands does not work on IRIX

    It assumes the output of "ls /bin/ls" is a line
    that starts with a '-'. On IRIX that file is
    a symbolic link, so the first character is an l.
    This causes test_getstatus to fail.
2001-10-30 03:17:30 +00:00
Guido van Rossum ed87ad876b Minimal test for __del__ hook. 2001-10-30 02:33:02 +00:00
Fredrik Lundh 4ecd71376c directory chooser (requires a recent version of Tk) 2001-10-29 22:58:55 +00:00
Tim Peters a427a2b8d0 Rename "dictionary" (type and constructor) to "dict". 2001-10-29 22:25:45 +00:00
Tim Peters c57a285cb4 SF bug #476138: tempfile behavior across platforms
Ensure that a tempfile can be closed any number of times without error.
This wasn't true on Windows.
2001-10-29 21:46:08 +00:00
Fred Drake 8e26b52a5c Update to reflect changes to the low-level logreader: share the info
dictionary instead of building a new one, and provide an overridable method
to allow subclasses to catch ADD_INFO records that are not part of the
initial block of ADD_INFO records created by the profiler itself.
2001-10-29 20:57:23 +00:00
Fred Drake f3c54d6fc7 Add a test for the insertion of user-provided ADD_INFO records. 2001-10-29 20:54:01 +00:00
Fred Drake 165b2cc2bd Allow user code to call the addinfo() method on the profiler object. 2001-10-29 20:48:09 +00:00
Jeremy Hylton e16e54f7f1 Use connect_ex() instead of connect().
Removes old XXX comment and possible source of long-delays.
2001-10-29 16:44:37 +00:00
Jeremy Hylton fbd5797eb7 Fix for SF bug 453099 -- select not defensive
And SF patch 473223 -- infinite getattr loop

Wrap select() and poll() calls with try/except for EINTR.  If EINTR is
raised, treat as a response where no fd is ready.

In dispatcher constructor, make sure self.socket is always
initialized.
2001-10-29 16:32:19 +00:00
Steven M. Gava 7c01786188 more loading from cfg files 2001-10-29 11:19:46 +00:00
Steven M. Gava 41a8532f66 more of config dialog reading from files 2001-10-29 08:05:34 +00:00
Guido van Rossum 9bd1401bbb Use sendall() in the stream test instead of send(). 2001-10-29 07:18:02 +00:00
Guido van Rossum cb65688218 Test sendall(). 2001-10-29 07:14:10 +00:00
Guido van Rossum b2c763fed2 Add 'sendall' to list of socket methods. 2001-10-29 07:13:53 +00:00
Fredrik Lundh b7747e2a2d added finditer sanity check 2001-10-28 20:15:40 +00:00
Tim Peters 4d85953fe6 dictionary() constructor:
+ Change keyword arg name from "x" to "items".  People passing a mapping
  object can stretch their imaginations <wink>.
+ Simplify the docstring text.
2001-10-27 18:27:48 +00:00
Tim Peters 9fda73cdd1 dict_constructor(): The last test was passing for the wrong reason (it
was intended to verify that sub-sequences of lengths 1 and 3 raise
ValueError, but was actually testing string lengths).
2001-10-26 20:57:38 +00:00
Fred Drake 5445f078df Re-arrange things and remove some unused variables/imports to keep pychecker
happy.  (This does not cover everything it complained about, though.)
2001-10-26 18:02:28 +00:00
Steven M. Gava 2a63a07912 further work supporting reading config dialog values form config files. 2001-10-26 06:50:54 +00:00
Steven M. Gava f126bcb653 dynamic option menu widget. 2001-10-26 06:49:14 +00:00
Steven M. Gava 485f7b6b58 further work on loading config dialog values from the config files 2001-10-26 06:47:09 +00:00
Tim Peters 1fc240e851 Generalize dictionary() to accept a sequence of 2-sequences. At the
outer level, the iterator protocol is used for memory-efficiency (the
outer sequence may be very large if fully materialized); at the inner
level, PySequence_Fast() is used for time-efficiency (these should
always be sequences of length 2).

dictobject.c, new functions PyDict_{Merge,Update}FromSeq2.  These are
wholly analogous to PyDict_{Merge,Update}, but process a sequence-of-2-
sequences argument instead of a mapping object.  For now, I left these
functions file static, so no corresponding doc changes.  It's tempting
to change dict.update() to allow a sequence-of-2-seqs argument too.

Also changed the name of dictionary's keyword argument from "mapping"
to "x".  Got a better name?  "mapping_or_sequence_of_pairs" isn't
attractive, although more so than "mosop" <wink>.

abstract.h, abstract.tex:  Added new PySequence_Fast_GET_SIZE function,
much faster than going thru the all-purpose PySequence_Size.

libfuncs.tex:
- Document dictionary().
- Fiddle tuple() and list() to admit that their argument is optional.
- The long-winded repetitions of "a sequence, a container that supports
  iteration, or an iterator object" is getting to be a PITA.  Many
  months ago I suggested factoring this out into "iterable object",
  where the definition of that could include being explicit about
  generators too (as is, I'm not sure a reader outside of PythonLabs
  could guess that "an iterator object" includes a generator call).
- Please check my curly braces -- I'm going blind <0.9 wink>.

abstract.c, PySequence_Tuple():  When PyObject_GetIter() fails, leave
its error msg alone now (the msg it produces has improved since
PySequence_Tuple was generalized to accept iterable objects, and
PySequence_Tuple was also stomping on the msg in cases it shouldn't
have even before PyObject_GetIter grew a better msg).
2001-10-26 05:06:50 +00:00
Guido van Rossum 6661be3bed Allow assignment to newinstance.__dict__. 2001-10-26 04:26:12 +00:00
Guido van Rossum 0afde13b43 Fix two typos, one noted by Noah Spurrier in SF bug #475166, the
second noted after a second's thought about what the next line should
do. :-(
2001-10-26 03:38:46 +00:00
Barry Warsaw 2539cf5aad A fix for SF bug #472560, extra newlines returned by get_param() when
the separating semi-colon shows up on a continuation line (legal, but
weird).

Bug reported and fixed by Matthew Cowles.  Test case and sample email
included.
2001-10-25 22:43:46 +00:00
Barry Warsaw 107771a228 Applying proposed patch for bug #474583, optional support for
non-standard but common types.  Including Martin's suggestion to add
rejected non-standard types from patch #438790.  Specifically,

guess_type(), guess_extension(): Both the functions and the methods
grow an optional "strict" flag, defaulting to true, which determines
whether to recognize non-standard, but commonly found types or not.

Also, I sorted, reformatted, and culled duplicates from the big
types_map dictionary.  Note that there are a few non-equivalent
duplicates (e.g. .cdf and .xls) for which the first will just get
thrown away.  I didn't remove those though.

Finally, use of the module as a script as grown the -l and -e options
to toggle strictness and to do guess_extension(), respectively.

Doc and unittest updates too.
2001-10-25 21:49:18 +00:00
Fred Drake b112481f12 Ignore the posixfile deprecation warning for the test suite. 2001-10-25 18:11:10 +00:00
Fredrik Lundh 703ce8122c (experimental) "finditer" method/function. this works pretty much
like findall, but returns an iterator (which returns match objects)
instead of a list of strings/tuples.
2001-10-24 22:16:30 +00:00
Fred Drake 9242a4af17 Add a warning to the posixfile module stating that it will go away. 2001-10-24 22:03:35 +00:00
Guido van Rossum e2ae77b8b8 SF patch #474590 -- RISC OS support 2001-10-24 20:42:55 +00:00
Tim Peters c6ac8a78f6 SF bug #473525 pyclbr broken
As the comments in the module implied, pyclbr was easily confused by
"strange stuff" inside single- (but not triple-) quoted strings.  It
isn't anymore.  Its behavior remains flaky in the presence of nested
functions and classes, though.
Bugfix candidate.
2001-10-24 20:22:40 +00:00
Guido van Rossum 83c3281826 Apply the first chunk of the second patch from SF bug #471720:
ThreadingMixIn/TCPServer forgets close (Max Neunhöffer).

This ensures that handle_error() and close_request() are called when
an error occurs in the thread.

(I am not applying the second chunk of the patch, which moved the
finish() call into the finally clause in BaseRequestHandler's __init__
method; that would be a semantic change that I cannot accept at this
point - the data would be sent even if the handler raised an
exception.)
2001-10-23 21:42:45 +00:00
Guido van Rossum f66dacdb01 test_curses is an expected skip on Linux too. 2001-10-23 15:10:55 +00:00
Steven M. Gava 429a86af5b font/tabs config dialog page now reads its data from the config file 2001-10-23 10:42:12 +00:00
Tim Peters c77db34575 SF bug [#473864] doctest expects spurios space.
Repair unlikely surprise due to magical softspace attr and the use of
print with a trailing comma in doctest examples.
Bugfix candidate.
2001-10-23 02:21:52 +00:00
Tim Peters d703057752 Record that test_curses doesn't run on win32. 2001-10-22 22:06:08 +00:00
Fred Drake 4bf018b138 Fixed denial-of-weak-ref-support test; Jeremy changed the error message
used by the weakref code since he didn't like the word "referencable".
Is it really necessary to be more specific than to test for TypeError here,
though?
2001-10-22 21:45:25 +00:00
Jeremy Hylton efef5dae94 A few formatting nits:
Don't put paren in column 0 (to please font-lock mode).
    Put space after comma in argument list.
2001-10-22 18:14:15 +00:00
Andrew M. Kuchling 2158df0b4d Patch #473187: Add a test script that exercises most of the functions in
the curses module.  It's not run automatically; '-u curses' must be
    specified as an argument to regrtest
2001-10-22 15:26:09 +00:00
Fredrik Lundh f864aa8fd9 sre.split should return the last segment, even if empty
(sorry, barry)
2001-10-22 06:01:56 +00:00
Guido van Rossum 56ff387a7e Fix for SF bug #472940: can't getattr() attribute shown by dir()
There really isn't a good reason for instance method objects to have
their own __dict__, __doc__ and __name__ properties that just delegate
the request to the function (callable); the default attribute behavior
already does this.

The test suite had to be fixed because the error changes from
TypeError to AttributeError.
2001-10-22 02:00:09 +00:00
Guido van Rossum c8e5645f15 Methods of built-in types now properly check for keyword arguments
(formerly these were silently ignored).  The only built-in methods
that take keyword arguments are __call__, __init__ and __new__.
2001-10-22 00:43:43 +00:00
Guido van Rossum d6bebce5e5 Make tabnanny happy. (Piers, please run the test suite before
checking in changes.  The test suite requires consistent use of spaces
and tabs.)
2001-10-22 00:42:26 +00:00
Piers Lauder fe6accfc36 update version number 2001-10-21 22:37:28 +00:00
Fredrik Lundh dac58492aa fixed character set description in docstring (SRE uses Python
strings, not C strings)

removed USE_PYTHON defines, and related sre.py helpers

skip calling the subx helper if the template is callable.
interestingly enough, this means that

	def callback(m):
	    return literal
	result = pattern.sub(callback, string)

is much faster than

	result = pattern.sub(literal, string)
2001-10-21 21:48:30 +00:00
Piers Lauder 0402dd18cb fix send method not noticing when partial sends happen 2001-10-21 20:26:37 +00:00
Fredrik Lundh 1296a8d77e sre.Scanner fixes (from Greg Chapman). also added a Scanner sanity
check to the test suite.

added a few missing exception checks in the _sre module
2001-10-21 18:04:11 +00:00
Fredrik Lundh bec95b9d88 rewrote the pattern.sub and pattern.subn methods in C
removed (conceptually flawed) getliteral helper; the new sub/subn code
uses a faster code path for literal replacement strings, but doesn't
(yet) look for literal patterns.

added STATE_OFFSET macro, and use it to convert state.start/ptr to
char indexes
2001-10-21 16:47:57 +00:00
Skip Montanaro 3e7bba9ac6 added tests for long ints and ints where they are > 32 bits.
should have been checked in as part of patch #470254.
2001-10-19 16:06:52 +00:00
Marc-André Lemburg b5507ecd3c Additional test and documentation for the unicode() changes.
This patch should also be applied to the 2.2b1 trunk.
2001-10-19 12:02:29 +00:00
Barry Warsaw 1f0fa92b0a Another merge from mimelib:
TestMIMEMessage.test_epilogue(), TestIdempotent.test_preamble_epilogue():
    Test cases for SF bug #472481.
2001-10-19 04:08:59 +00:00
Barry Warsaw 11ce550578 Another email package test file 2001-10-19 04:07:27 +00:00
Barry Warsaw 856c32b5f4 Another merge from mimelib:
_handle_multipart(): If there is an epilogue and the epilogue does
    not itself start with a newline, add a newline before writing the
    epilogue.  Closes SF bug #472481.
2001-10-19 04:06:39 +00:00
Guido van Rossum c524d952da SF patch #460805 by Chris Gonnerman: Support for unsetenv()
This adds unsetenv to posix, and uses it in the __delitem__ method of
os.environ.

(XXX Should we change the preferred name for putenv to setenv, for
consistency?)
2001-10-19 01:31:59 +00:00
Martin v. Löwis a660a34844 Assume a 64-bit start and len if O_LARGEFILE is available. 2001-10-18 22:07:48 +00:00
Tim Peters e0c446bb4a Whitespace normalization. 2001-10-18 21:57:37 +00:00
Guido van Rossum 1fff878c45 The assignment to result.st_rdev can raise AttributeError as well as
TypeError (on systems where it's not defined at all, it raises
AttributeError; when it's defined, assignment to it raises TypeError).
2001-10-18 21:19:31 +00:00
Fredrik Lundh a5e616510e changed misleading argument name 2001-10-18 20:58:25 +00:00
Guido van Rossum 98bf58f1c6 SF patch #462296: Add attributes to os.stat results; by Nick Mathewson.
This is a big one, touching lots of files.  Some of the platforms
aren't tested yet.  Briefly, this changes the return value of the
os/posix functions stat(), fstat(), statvfs(), fstatvfs(), and the
time functions localtime(), gmtime(), and strptime() from tuples into
pseudo-sequences.  When accessed as a sequence, they behave exactly as
before.  But they also have attributes like st_mtime or tm_year.  The
stat return value, moreover, has a few platform-specific attributes
that are not available through the sequence interface (because
everybody expects the sequence to have a fixed length, these couldn't
be added there).  If your platform's struct stat doesn't define
st_blksize, st_blocks or st_rdev, they won't be accessible from Python
either.

(Still missing is a documentation update.)
2001-10-18 20:34:25 +00:00
Tim Peters 8dd7adeb34 SF bug [#472347] pydoc and properties.
The GUI-mode code to display properties blew up if the property functions
(get, set, etc) weren't simply methods (or functions).

"The problem" here is really that the generic document() method dispatches
to one of .doc{routine, class, module, other}(), but all of those require
a different(!) number of arguments.  Thus document isn't general-purpose
at all:  you have to know exactly what kind of thing is it you're going
to document first, in order to pass the correct number of arguments to
.document for it to pass on.  As an expedient hack, just tacked "*ignored"
on to the end of the formal argument lists for the .docXXX routines so
that .document's caller doesn't have to know in advance which path
.document is going to take.
2001-10-18 19:56:17 +00:00
Fred Drake c10039c011 Do not expect line number events when running under "python -O".
The right fix is to generate line number events anyway ;-), but this will
have to do for now.
2001-10-18 19:34:00 +00:00
Fredrik Lundh 397a654791 SRE bug #441409:
compile should raise error for non-strings
SRE bug #432570, 448951:
    reset group after failed match

also bumped version number to 2.2.0
2001-10-18 19:30:16 +00:00
Fred Drake 3bb4d214a4 Add a test for calling a weakref proxy with a dictionary of keyword args. 2001-10-18 19:28:29 +00:00
Guido van Rossum 4114a4afec Fix the frozen bytecode for __hello__ (betcha didn't know that existed
:-).

Add a test that prevents the __hello__ bytecode from going stale
unnoticed again.

The test also tests the loophole noted in SF bug #404545.  This test
will fail right now; I'll check in the fix in a minute.
2001-10-18 18:49:37 +00:00
Fred Drake 39c27f1ffb Make sure we do not core dump when using proxies with the binary slot
handlers.  This was fixed in Objects/weakrefobject.c 1.2.
2001-10-18 18:06:05 +00:00
Guido van Rossum a5343ccd28 SF bug #471720: ThreadingMixIn/TCPServer forgets close
Solved with a helper method that calls finish_request() and then
close_request().  The code is by Max Neunhöffer.
2001-10-18 18:02:07 +00:00
Martin v. Löwis 29103c7b32 Reindent __repr__. 2001-10-18 17:33:19 +00:00
Jeremy Hylton cf672f15e0 Add test for local assigned to only in a nested list comp 2001-10-18 16:23:11 +00:00
Guido van Rossum f76de62f7d Fix SF bug #472234: type(obj) calls type->tp_init (Roeland Rengelink)
The fix is a band-aid: type_call() now makes the same exception for a
single-argument call to type() as type_new() was already making.
2001-10-18 15:49:21 +00:00
Martin v. Löwis eee80ee2ef Patch #470744: Simplify __repr__ error handling. 2001-10-18 11:39:34 +00:00
Jeremy Hylton 9f6c37df26 Add trivial test cases for RAND_add() and RAND_status().
(The rest of the test cases are trivial, so I don't feel too bad.)
2001-10-18 00:30:14 +00:00
Skip Montanaro 5449e08412 test for int and long int overflow (allows operation on 64-bit platforms)
closes patch 470254
2001-10-17 22:53:33 +00:00
Barry Warsaw 07227d1ec0 Two merges from the mimelib project:
test_no_semis_header_splitter(): This actually should still split.

    test_no_split_long_header(): An example of an unsplittable line.

    test_no_semis_header_splitter(): Test for SF bug # 471918, Generator
    splitting long headers.
2001-10-17 20:52:26 +00:00
Barry Warsaw d1eeecbd43 Two merges from the mimelib project:
_split_header(): Split on folding whitespace if the attempt to split
    on semi-colons failed.

    _split_header(): Patch by Matthew Cowles for fixing SF bug # 471918,
    Generator splitting long headers.
2001-10-17 20:51:42 +00:00
Guido van Rossum 1f74cb3575 Oops. Catching OverflowError from int() doesn't help, since it raises
ValueError on too-large inputs.
2001-10-17 17:21:47 +00:00
Jeremy Hylton 7a1ea0e880 Make sure the output lists are sorted, even if run with -r. 2001-10-17 13:45:28 +00:00
Jeremy Hylton 138d90eb73 Vastly improved stacksize calculation.
There are now no known cases where the compiler package computes a
stack depth lower than the one computed by the builtin compiler.  (To
achieve this state, we had to fix bugs in both compilers :-).

The chief change is to do the depth calculations with respect to basic
blocks.  The stack effect of block is calculated.  Then the flow graph
is traversed using breadth-first search to find the max weight path
through the graph.

Had to fix the StackDepthTracker to calculate the right info for
several opcodes: LOAD_ATTR, CALL_FUNCTION (and friends), MAKE_CLOSURE,
and DUP_TOPX.

XXX Still need to handle free variables in MAKE_CLOSURE.

XXX There are still a lot of places where the computed stack depth is
larger than for the builtin compiler.  These won't cause the
interpreter to overflow the frame, but they waste space.
2001-10-17 13:37:29 +00:00
Jeremy Hylton d114261608 Handle testlist_safe as if it were testlist. 2001-10-17 13:32:52 +00:00
Jeremy Hylton 4bf1fb63e4 track addition of testlist_safe to Grammar 2001-10-17 13:13:04 +00:00
Guido van Rossum bcbdc95e90 SF patch #467430.
- replace some log_error() calls with log_message()

- flush self.rfile before forking too (hope this works on Windows)
2001-10-17 06:45:56 +00:00
Guido van Rossum f93befc209 Folder.getlast(): avoid PyChecker warning. 2001-10-17 05:59:26 +00:00
Fred Drake 2a2d970ef9 Remove unused import; reported by Neal Norwitz. 2001-10-17 01:51:04 +00:00
Fred Drake d10ed8b179 Minor code cleanups based on comments from Neal Norwitz. 2001-10-17 01:49:50 +00:00
Jeremy Hylton 511e2cacc4 [ #403753 ] zlib decompress; uncontrollable memory usage
Mostly by Toby Dickenson and Titus Brown.

Add an optional argument to a decompression object's decompress()
method.  The argument specifies the maximum length of the return
value.  If the uncompressed data exceeds this length, the excess data
is stored as the unconsumed_tail attribute.  (Not to be confused with
unused_data, which is a separate issue.)

Difference from SF patch: Default value for unconsumed_tail is ""
rather than None.  It's simpler if the attribute is always a string.
2001-10-16 20:39:49 +00:00
Tim Peters c993315b18 SF bug [#468061] __str__ ignored in str subclass.
object.c, PyObject_Str:  Don't try to optimize anything except exact
string objects here; in particular, let str subclasses go thru tp_str,
same as non-str objects.  This allows overrides of tp_str to take
effect.

stringobject.c:
+ string_print (str's tp_print):  If the argument isn't an exact string
  object, get one from PyObject_Str.

+ string_str (str's tp_str):  Make a genuine-string copy of the object if
  it's of a proper str subclass type.  str() applied to a str subclass
  that doesn't override __str__ ends up here.

test_descr.py:  New str_of_str_subclass() test.
2001-10-16 20:18:24 +00:00
Guido van Rossum b6aca6afe2 Fix SF bug #459767: ftplib fails with files > 2GB
size(), parse150(): try int() first, catch OverflowError, fall back to
long().
2001-10-16 19:45:52 +00:00
Tim Peters a7e1f43bd9 Remove obsolete __dynamic__ distinction. 2001-10-15 22:59:59 +00:00
Tim Peters 6006629c3c Remove obsolete __dynamic__ distinction. 2001-10-15 22:53:29 +00:00
Tim Peters 1ce150c675 Remove obsolete __static__/__dynamic__ distinction. 2001-10-15 22:49:27 +00:00
Fred Drake 47cada7ab8 pstats-compatible analysis module.
hotshot.stats.load(logfilename) returns a pstats.Stats instance, which is
about as compatible as it gets.
2001-10-15 22:18:53 +00:00
Fred Drake e7d8a78b8e runcall(): Expose the return value of the profiled function; this allows
changing an application to collect profile data on one part of the
    app while still making use of the profiled component, without relying
    on side effects.
2001-10-15 22:14:29 +00:00
Fred Drake d5d5a04040 Avoid deep recursion when reading the header of the log file.
Add support for extracting function names from the log file, keeping the
extract-names-from-sources support as a fallback.
2001-10-15 22:05:32 +00:00
Guido van Rossum 687ae00460 Get rid of __defined__ and tp_defined -- there's no need to
distinguish __dict__ and __defined__ any more.  In the C structure,
tp_cache takes its place -- but this hasn't been implemented yet.
2001-10-15 22:03:32 +00:00
Jeremy Hylton 6642653875 Covert pickle tests to use unittest.
Extend tests to cover a few more cases.  For cPickle, test several of
the undocumented features.
2001-10-15 21:38:56 +00:00
Jeremy Hylton abe2c62bdb Use cStringIO when available.
Remove test code.  It's available in Lib/test/picklertester.py.
2001-10-15 21:29:28 +00:00
Guido van Rossum 2f3ca6eeb6 Completely get rid of __dynamic__ and the corresponding
Py_TPFLAGS_DYNAMICTYPE bit.  There is no longer a performance benefit,
and I don't really see the use case any more.
2001-10-15 21:05:10 +00:00
Guido van Rossum 1346e83eb0 Patch 471400: escape single-dot lines; by Jason Hildebrand.
RFC 2049 recommends never outputting a line consisting of a single
dot.
2001-10-15 18:44:26 +00:00
Guido van Rossum c0f1bfec05 SF bug #469910 by Alfonso Baciero: Bugfix for imaplib for macintosh
Pass binary mode to makefile().
2001-10-15 13:47:08 +00:00
Barry Warsaw cdc632cfdb test_typed_subpart_iterator_default_type(): Test for when the message
has no Content-Type: header, it should be treated as text/plain.
2001-10-15 04:39:02 +00:00
Barry Warsaw 0164b6bf22 typed_subpart_iterator(): When getting the main type use 'text' as the
failobj, and when getting the subtype use 'plain' as the failobj.
text/plain is supposed to be the default if the message contains no
Content-Type: header.
2001-10-15 04:38:22 +00:00
Fred Drake 4c85da4d16 "ib" should be "boundary"; reported by Neal Norwitz. 2001-10-13 18:38:53 +00:00
Fred Drake c680ae8002 Added missing parameter in call to http_error_default();
reported by Neal Norwitz.
2001-10-13 18:37:07 +00:00
Fred Drake 2f8f4d3678 SMTPError should be SMTPException; reported by Neal Norwitz. 2001-10-13 18:35:32 +00:00
Fred Drake f902296a18 Ignore execfile() return value; reported by Neal Norwitz. 2001-10-13 18:34:42 +00:00
Fred Drake 95b0eb7cb3 "f" should be "self"; reported by Neal Norwitz. 2001-10-13 18:33:51 +00:00
Fred Drake 16623fe3e6 _os should be os; reported by Neal Norwitz. 2001-10-13 16:00:52 +00:00
Fred Drake 3d32be192c Remove extra param from call to self.error().
Reported by Neal Norwitz.
2001-10-13 15:59:47 +00:00
Martin v. Löwis dc57909323 Move grid_location into Misc. Fixes bug #426892. 2001-10-13 09:33:51 +00:00
Fred Drake c687960496 Remove some unused imports.
Remove the log file after we are done with it.  This should clean up after
the test even on Windows, since the file is now closed before we attempt
removal.
2001-10-13 03:00:11 +00:00
Fred Drake d62f151a2c When we reach the end of the log file, close the logreader object. 2001-10-13 02:55:40 +00:00
Tim Peters 10603b8799 You can't unlink open files on Windows.
Simply commented it out, and then test_hotshot passes on Windows.
Leaving to Fred to fix "the right way" (it seems to be a feature of
unittest that all unittests try to unlink open files <wink>).
2001-10-13 00:19:39 +00:00
Martin v. Löwis 106bdd3b80 Correct __repr__: include module name, avoid extra space for empty status,
use 0x format for id. Proposed by Cesar Eduardo Barros in patch #470680.
2001-10-12 22:39:20 +00:00
Fred Drake f019324b5c Preliminary user-level interface to HotShot. We still need the analysis
tool; look for that on Monday.
2001-10-12 20:56:29 +00:00
Fred Drake de3cdcadce A most trivial test for HotShot -- make sure we get reasonable events
reported and can read the log back in.
2001-10-12 20:53:59 +00:00
Guido van Rossum ea32cbb24e Suggestion from SF patch #470433 to avoid clobbering TCL_LIBRARY et
al. if already set.  Also adds TIX_LIBRARY (just in case).
(Note that this is entirely Windows specific.)
2001-10-12 15:34:29 +00:00
Tim Peters fc57ccb982 SF bug [#470040] ParseTuple t# vs subclasses.
inherit_slots():  tp_as_buffer was getting inherited as if it were a
method pointer, rather than a pointer to a vector of method pointers.  As
a result, inheriting from a type that implemented buffer methods was
ineffective, leaving all the tp_as_buffer slots NULL in the subclass.
2001-10-12 02:38:24 +00:00
Guido van Rossum 875eeaa193 Another step in the right direction: when a new class's attribute
corresponding to a dispatch slot (e.g. __getitem__ or __add__) is set,
calculate the proper dispatch slot and propagate the change to all
subclasses.  Because of multiple inheritance, there's no easy way to
avoid always recursing down the tree of subclasses.  Who cares?

(There's more to do, but this works.  There's also a test for this now.)
2001-10-11 18:33:53 +00:00
Tim Peters f3623f310e Somebody checked in a version of httplib that doesn't even compile --
SyntaxError.  Fix it.
2001-10-11 18:15:51 +00:00
Jeremy Hylton 6459c8d067 Fix for SF buf #458835
Try to be systematic about dealing with socket and ssl exceptions in
FakeSocket.makefile().  The previous version of the code caught all
ssl errors and treated them as EOF, even though most of the errors
don't mean EOF.

An SSL error can mean on of three things:

    1. The SSL/TLS connection was closed.
    2. The operation should be retried.
    3. An error occurred.

Also, if a socket error occurred and the error was EINTR, retry the
call.  Otherwise, it was a legitimate error and the caller should
receive the exception.
2001-10-11 17:47:22 +00:00
Barry Warsaw bf7a59d94b Add a test for the HeaderParser class. 2001-10-11 15:44:50 +00:00
Barry Warsaw e552882960 HeaderParser: A new subclass of Parser which only parses the message
headers.  It does not parse the body of the message, instead simply
assigning it as a string to the container's payload.  This can be much
faster when you're only interested in a message's header.
2001-10-11 15:43:00 +00:00
Jeremy Hylton de7c1923c7 Add test of hexlify on Unicode strings 2001-10-11 14:09:03 +00:00
Skip Montanaro 5e9c71ba80 allow long ints to be marshalled as ints - no check is made to the incoming
value, so the programmer will have to catch OverflowError.  I'm not sure
what /F's perspective is on this.  Perhaps it should be caught and mapped to
an xmlrpclib-specific exception.  None of the other type-specific dump
methods seem to do any exception handling though.
2001-10-10 15:56:34 +00:00
Tim Peters cf5e6a4a5d SF bug [#469732] os.path.walk docstring inconsistent.
We have 5 implementations of walk(), and 5 different docstrings.  Combined
'em.  Let's see how long it takes before they're all different again!
2001-10-10 04:16:20 +00:00
Jeremy Hylton 7d3dff2b39 SF patch [ #468662 ] Allow jython to complete test_grammar
The behavior of co_varnames in the presence of nested argument tuples
is not consistent across Python and Jython.  Test each platform
separately.
2001-10-10 01:45:02 +00:00
Tim Peters e13cc92e6c Repair key stutter + auto-complete ugliness. 2001-10-09 21:01:31 +00:00
Fred Drake 3e5e661150 Remove obsolete email address. 2001-10-09 20:53:48 +00:00
Tim Peters 659a60311d Allow the profiler's calibration constant to be specified in the constructor
call, or via setting an instance or class vrbl.
Rewrote the calibration docs.
Modern boxes are so friggin' fast, and a profiler event does so much work
anyway, that the cost of looking up an instance vrbl (the bias constant)
per profile event just isn't a big deal.
2001-10-09 20:51:19 +00:00
Guido van Rossum 12b22ff6d7 Add a bunch of tests for a list subclass that would have caught the
previous embarrassment (typeobject.c checking crashing minidom).
2001-10-09 20:36:44 +00:00
Barry Warsaw 53f8fe4232 An audio/* class, like MIMEImage, contributed by Anthony Baxter.
Rewritten for style and the email package naming conventions by
Barry.
2001-10-09 19:41:18 +00:00
Guido van Rossum 7b9144b2ee Halfway checkin. This is still messy, but it's beginning to address
the problem that slots weren't inherited properly.  override_slots()
no longer exists; in its place comes fixup_slot_dispatchers() which
does more and different work and is table-based.  (Eventually I want
this table also to replace all the little tab_foo tables.)

Also add a wrapper for __delslice__; this required a change in
test_descrtut.py.
2001-10-09 19:39:46 +00:00
Barry Warsaw fee435af8b Added tests for MIMEAudio class/module 2001-10-09 19:23:57 +00:00
Barry Warsaw 2ae0b0163a Fix __all__ to the current list of exported modules (must pass the
tests in test_email.py).
2001-10-09 19:14:59 +00:00
Jeremy Hylton 8b78b99647 Fix [ #465502 ] urllib2: urlopen unicode problem
When checking for strings use,
!         if isinstance(uri, (types.StringType, types.UnicodeType)):

Also get rid of some dodgy code that tried to guess whether attributes
were callable or not.
2001-10-09 16:18:45 +00:00
Barry Warsaw 2f6a0b00a0 Add a test for get_all() returning failobj. msg_20.txt is a sample
message with multiple CC: fields, used in the get_all() test.
2001-10-09 15:49:35 +00:00
Barry Warsaw 9300a75c88 get_all(): We never returned failobj if we found no matching headers.
Fix that, and also make the docstring describe failobj.
2001-10-09 15:48:29 +00:00
Barry Warsaw 93a6327adf SMTPServer.__init__(): The asyncore.dispatcher base class has a method
set_reuse_addr() that does the setsockopt fiddling.  Use it instead.
2001-10-09 15:46:31 +00:00
Martin v. Löwis 3e048485f9 Add entry parameter to HList.item_cget. Fixes bug #466981. 2001-10-09 11:50:55 +00:00
Guido van Rossum 0eb2a6e974 It turned out not so difficult to support old-style numbers (those
without the Py_TPFLAGS_CHECKTYPES flag) in the wrappers.  This
required a few changes in test_descr.py to cope with the fact that the
complex type has __int__, __long__ and __float__ methods that always
raise an exception.
2001-10-09 11:07:24 +00:00
Martin v. Löwis 6ec9a36faf Patch #468647: Fix exception propagation in asyncore. 2001-10-09 10:10:33 +00:00
Tim Peters cce092d046 A brand new implementation of Profile.calibrate(). This measures an
actual run of the profiler, instead of timing a simplified simulation of
part of what the profiler does.  It computes a constant about 60% higher
on my Win98SE box than the old method, and the new constant appears much
more realistic.  Deleted the undocumented simple(), instrumented(), and
profiler_simulation() methods (which existed only to support the previous
calibration method).
2001-10-09 05:31:56 +00:00
Fred Drake 168beada91 Added tests that check getboolean() with the newly allowed values from
SF patch #467580.
2001-10-08 17:13:12 +00:00
Guido van Rossum 4570455813 Change all occurrences of verify(x == y) into vereq(x, y), since when
this type of test fails, vereq() does a better job of reporting than
verify().

Change vereq(x, y) to use "not x == y" rather than "x != y" -- it
makes a difference is some overloading tests.
2001-10-08 16:35:45 +00:00
Tim Peters 281084f798 Put the deprecated .ignore() method back where it was. 2001-10-08 06:28:18 +00:00
Tim Peters 7d01685738 Widespread random code cleanup.
Most of this code was old enough to vote.  Examples of cleanups:

+ Backslashes were used for line continuation even inside unclosed
  bracket structures, from back in the days that was still needed.

+ There was no use of % formats, and e.g. the old fpformat module was
  still used to format floats "by hand" in conjunction with rjust().

+ There was even use of a do-nothing .ignore() method to tack on to the
  end of a chain of method calls, else way back when Python would print
  the non-None result (as it does now in an interactive session -- it
  *used* to do that in batch mode too).

+ Perhaps controversial (although I can't imagine why for real <wink>),
  used augmented assignment where helpful.  Stuff like

      self.total_calls = self.total_calls + other.total_calls

  is just plain harder to follow than

      self.total_calls += other.total_calls
2001-10-08 06:13:19 +00:00
Steven M. Gava 1f733baa04 merged port binding error message patch 2001-10-07 11:44:49 +00:00
Steven M. Gava 4eb286874f merged win spawn patch 2001-10-07 11:26:48 +00:00
Steven M. Gava 898a365c27 merged status bar packing patch 2001-10-07 11:10:44 +00:00
Martin v. Löwis 322c0d187d Only close sockets if they have been created. Reported by Blake Winton. 2001-10-07 08:53:32 +00:00
Tim Peters fb163784ab Typo repair in comment. 2001-10-07 08:49:02 +00:00
Tim Peters 8d061ed75b Guido points out that the comments for self.cur[2] were subtly but
seriously wrong.  This started out by just fixing the docs, but then it
occurred to me that the doc confusion propagated into misleading vrbl names
too, so I also renamed those to match reality.  As a result, INO the time
computations are much easier to understand now (within the limitations of
vast quantities of 3-character names <wink>).
2001-10-07 08:35:44 +00:00
Tim Peters db1ed2aec3 At Guido's request, changed the code that's conceptually asserting stuff
to use assert stmts (was raising unexpected kinds of exceptions).
2001-10-07 04:30:53 +00:00
Tim Peters 6e22149cb6 Repair some longstanding comment errors:
+ The last index in the timing tuple is 4, not 5 (noted by Guido).

+ The poorly named trace_dispatch_i works with float return values too.
2001-10-07 04:02:36 +00:00
Tim Peters 0a1fc4e389 Remove code and docs for the OldProfile and HotProfile classes: code
hasn't worked in years, docs were wrong, and they aren't interesting
anymore regardless.
2001-10-07 03:12:08 +00:00
Tim Peters df5cfd884d The fix to profile semantics broke the miserable but advertised way to
derive Profile subclasses.  This patch repairs that, restoring
negative tuple indices.  Yuck?  You bet.
2001-10-05 23:15:10 +00:00
Fred Drake e029242d5c ReferenceError is now built-in, so pick it up from the right place.
It still needs to be here to preserve the API.
2001-10-05 21:54:09 +00:00
Guido van Rossum 39c785108f Martijn Pieters convinced me that when readline() strips the trailing
newline from a multifile part, it should also strip a trailing \r\n.
2001-10-05 21:22:21 +00:00
Guido van Rossum 9475a2310d Enable GC for new-style instances. This touches lots of files, since
many types were subclassable but had a xxx_dealloc function that
called PyObject_DEL(self) directly instead of deferring to
self->ob_type->tp_free(self).  It is permissible to set tp_free in the
type object directly to _PyObject_Del, for non-GC types, or to
_PyObject_GC_Del, for GC types.  Still, PyObject_DEL was a tad faster,
so I'm fearing that our pystone rating is going down again.  I'm not
sure if doing something like

void xxx_dealloc(PyObject *self)
{
	if (PyXxxCheckExact(self))
		PyObject_DEL(self);
	else
		self->ob_type->tp_free(self);
}

is any faster than always calling the else branch, so I haven't
attempted that -- however those types whose own dealloc is fancier
(int, float, unicode) do use this pattern.
2001-10-05 20:51:39 +00:00
Thomas Heller be63884d50 With Andrew's blessing: distutils version number is now 1.0.3. 2001-10-05 20:43:09 +00:00
Thomas Heller e138f369e6 Explicitely list the metadata attributes to show
in the gui.
Updated to include the new exe-file.
2001-10-05 20:40:48 +00:00
Barry Warsaw 4a8e9f4e42 SMTPServer.__init__(): Print the start information on the DEBUGSTREAM
so that it can be suppressed.
2001-10-05 17:10:31 +00:00
Fred Drake 4e7cdb57f9 Non-failing test for SF bug #467059. 2001-10-04 20:05:10 +00:00
Guido van Rossum fb06f75c5a Apply modified SF patch 467580: ConfigParser.getboolean(): FALSE, TRUE.
This patch allows ConfigParser.getboolean() to interpret TRUE,
    FALSE, YES, NO, ON and OFF instead just '0' and '1'.

    While just allowing '0' and '1' sounds more correct users often
    demand to use more descriptive directives in configuration
    files. Instead of forcing every programmer do brew his own
    solution a system should include the batteries for this.

[My modification to the patch is a slight rewording of the docstring
and use of lowercase instead of uppercase templates.  The code is
still case sensitive. GvR.]
2001-10-04 19:58:46 +00:00
Fred Drake 266410355f run_suite(): If testclass is not available, provide an even more general
error message.
run_unittest():  Provide the testclass to run_suite() so it can construct
                 the error message.
This closes SF bug #467763.
2001-10-04 19:46:07 +00:00
Barry Warsaw d1de6eacf2 TestIterators: Tim Peters suggests a more succinct spelling of
"listify an iterator".
2001-10-04 18:18:37 +00:00
Barry Warsaw c4496f886b More test data for test_email.py 2001-10-04 17:59:42 +00:00
Barry Warsaw 08a534d476 test_header_splitter(), test_body_line_iterator(): Move the test data
into tests/data/msg_*.txt files.
2001-10-04 17:58:50 +00:00
Barry Warsaw e968ead1dd Give me back my page breaks. 2001-10-04 17:05:11 +00:00
Barry Warsaw 0e8427e4f2 Script arguments localhost:localport and remotehost:remoteport are now
optional, and default to `localhost' and ports 8025 and 25
respectively.

SMTPChannel.__init__(): Calculate __fqdn using socket.getfqdn()
instead of gethostby*() and friends.  This allows us to run this
script even if we don't have access to dns (assuming the localhost is
configured properly).

Also, restore my precious page breaks.  Hands off, oh Whitespace
Normalizer!
2001-10-04 16:27:04 +00:00
Fred Drake 7c0a93d966 Updated to reflect the rationalized profiler event reporting. 2001-10-04 14:49:46 +00:00
Tim Peters c59fb2d230 This test relied on hard tab characters, so failed after whitespace
normalization.  Now uses \t in strings instead of hard tabs.
2001-10-04 06:26:17 +00:00
Tim Peters 4fb1fe8bd2 class_docstrings(): The new-style class tests should use new-style
classes (sheesh!).
2001-10-04 05:48:13 +00:00
Tim Peters 527e64fd68 Whitespace normalization. 2001-10-04 05:36:56 +00:00
Tim Peters 2f93e28a19 SF bug [#467331] ClassType.__doc__ always None.
For a dynamically constructed type object, fill in the tp_doc slot with
a copy of the argument dict's "__doc__" value, provided the latter exists
and is a string.
NOTE:  I don't know what to do if it's a Unicode string, so in that case
tp_doc is left NULL (which shows up as Py_None if you do Class.__doc__).
Note that tp_doc holds a char*, not a general PyObject*.
2001-10-04 05:27:00 +00:00
Guido van Rossum f137f75ab8 Hopefully fix the profiler right. Add a test suite that checks that
it deals correctly with some anomalous cases; according to this test
suite I've fixed it right.

The anomalous cases had to do with 'exception' events: these aren't
generated when they would be most helpful, and the profiler has to
work hard to recover the right information.  The problems occur when C
code (such as hasattr(), which is used as the example here) calls back
into Python code and clears an exception raised by that Python code.
Consider this example:

    def foo():
        hasattr(obj, "bar")

Where obj is an instance from a class like this:

    class C:
        def __getattr__(self, name):
            raise AttributeError

The profiler sees the following sequence of events:

    call (foo)
    call (__getattr__)
    exception (in __getattr__)
    return (from foo)

Previously, the profiler would assume the return event returned from
__getattr__. An if statement checking for this condition and raising
an exception was commented out...  This version does the right thing.
2001-10-04 00:58:24 +00:00
Fred Drake 0099ba73de Add some more test cases to be sure we do the right thing in various cases. 2001-10-03 21:15:32 +00:00
Fred Drake a0bc9993e7 Undo previous patch; it did not quite work out. 2001-10-03 21:12:32 +00:00
Andrew M. Kuchling 4602c1b702 Set .addr in a few more places (patch approved by Sam Rushing) 2001-10-03 17:07:25 +00:00
Guido van Rossum 4a5a2bc2b6 dynamics(): add a dummy __getattr__ method to the C class so that the
test for modifying __getattr__ works, now that slot_tp_getattr_hook
zaps the slot if there's no hook.  Added an XXX comment with a ref
back to slot_tp_getattr_hook.
2001-10-03 13:59:54 +00:00
Skip Montanaro ae3b1258e4 remove empty __del__ method from BaseRequestHandler to avoid cyclic garbage
loss for no reason.
2001-10-03 12:21:23 +00:00
Tim Peters 1b0e5490c5 Made the classmethod docstring test a bit less trivial. 2001-10-03 04:15:28 +00:00
Tim Peters 17111f3b24 SF bug [#467336] doctest failures w/ new-style classes.
Taught doctest about static methods, class methods, and property docstrings
in new-style classes.  As for inspect.py/pydoc.py before it, the new stuff
needed didn't really fit into the old architecture (but was less of a
strain to force-fit here).
New-style class docstrings still aren't found, but that's the subject
of a different bug and I want to fix that right instead of hacking around
it in doctest.
2001-10-03 04:08:26 +00:00
Tim Peters 4a9ac4a83c SF patch [#466616] Exclude imported items from doctest.
Another installment; the new functionality wasn't actually enabled in
normal use, only in the strained use checked by the test case.
2001-10-02 22:47:08 +00:00
Guido van Rossum 048eb75c2d Add Garbage Collection support to new-style classes (not yet to their
instances).

Also added GC support to various auxiliary types: super, property,
descriptors, wrappers, dictproxy.  (Only type objects have a tp_clear
field; the other types are.)

One change was necessary to the GC infrastructure.  We have statically
allocated type objects that don't have a GC header (and can't easily
be given one) and heap-allocated type objects that do have a GC
header.  Giving these different metatypes would be really ugly: I
tried, and I had to modify pickle.py, cPickle.c, copy.py, add a new
invent a new name for the new metatype and make it a built-in, change
affected tests...  In short, a mess.  So instead, we add a new type
slot tp_is_gc, which is a simple Boolean function that determines
whether a particular instance has GC headers or not.  This slot is
only relevant for types that have the (new) GC flag bit set.  If the
tp_is_gc slot is NULL (by far the most common case), all instances of
the type are deemed to have GC headers.  This slot is called by the
PyObject_IS_GC() macro (which is only used twice, both times in
gcmodule.c).

I also changed the extern declarations for a bunch of GC-related
functions (_PyObject_GC_Del etc.): these always exist but objimpl.h
only declared them when WITH_CYCLE_GC was defined, but I needed to be
able to reference them without #ifdefs.  (When WITH_CYCLE_GC is not
defined, they do the same as their non-GC counterparts anyway.)
2001-10-02 21:24:57 +00:00
Guido van Rossum fe1fd0e6e9 pickles():
- The test for deepcopy() in pickles() was indented wrongly, so it got
  run twice (one for binary pickle mode, one for text pickle mode; but
  the test doesn't depend on the pickle mode).

- In verbose mode, show which subtest (pickle/cPickle/deepcopy, text/bin).
2001-10-02 19:58:32 +00:00
Guido van Rossum c907bd89de The error reporting here was a bit sparse. In verbose mode, the code
in run_test() referenced two non-existent variables, and in
non-verbose mode, the tests didn't report the actual number, when it
differed from the expected number.  Fixed this.

Also added an extra call to gc.collect() at the start of test_all().
This will be needed when I check in the changes to add GC to new-style
classes.
2001-10-02 19:49:47 +00:00