Commit Graph

5170 Commits

Author SHA1 Message Date
Guido van Rossum 49fa2bdaa1 Fix two bugs discovered by PyChecker. (I cannot test these, but I'm
confident that the old code was utterly broken -- the worse that can
happen is that the new code is still broken.)
2001-08-13 14:12:35 +00:00
Andrew M. Kuchling 246c425964 Fix for NameError caught by PyChecker.
(This command seems to be essentially untested; should fix that...)
2001-08-13 13:56:24 +00:00
Andrew M. Kuchling fd6608bcea Fix typo (PyChecker) 2001-08-13 13:48:55 +00:00
Andrew M. Kuchling fee3126eb3 Catch curses.error instead of a non-existent global (PyChecker)
Edit comment
2001-08-13 13:47:23 +00:00
Andrew M. Kuchling 40ea6177b9 Remove redundant import 2001-08-13 13:45:22 +00:00
Steven M. Gava 33277c767f further work on font config and general feel improvements 2001-08-13 04:36:58 +00:00
Tim Peters 5e824c37d3 SF patch #445412 extract ndiff functionality to difflib, from
David Goodger.
2001-08-12 22:25:01 +00:00
Jeremy Hylton 39f77bc90e Modify _Set to support iteration.
Otherwise printlist(surprise) will fail with a TypeError, because map
is called with an argument that doesn't support iteration.
2001-08-12 21:53:08 +00:00
Guido van Rossum d3077402c7 - Expand test for dynamic objects.
- Remove various 'global' directives and move some global definitions
  inside the test functions that use them -- we have nested scopes so
  the old hacks using globals are no longer needed.
2001-08-12 05:24:18 +00:00
Tim Peters a45da92484 Make the output of tests skipped readable (i.e., deliberately break it
into indented lines each of which probably fits on a typical screen line).
2001-08-12 03:45:50 +00:00
Guido van Rossum 9d4fe4298e dynamics(): add tests for dynamic *instances* (which are currently
broken).  Also fix an invalid reference to C (should be S).
2001-08-12 03:38:18 +00:00
Jeremy Hylton 08a6403973 Test the unary operator changes to the compiler 2001-08-12 02:22:27 +00:00
Guido van Rossum f73e30c3e3 Add the list of expected skips for Linux 2.x. Restructured the code a
little bit using a dictionary to avoid more code duplication as
more platforms are supported.
2001-08-12 02:22:19 +00:00
Tim Peters a2be2d624a Move line; reported on python-dev by Mark Favas (thanks!). 2001-08-12 02:01:09 +00:00
Tim Peters b5b7b78414 Teach regrtest which tests we *expect* to skip on Win32. Please teach it
about your platform too.
2001-08-12 01:20:39 +00:00
Steven M. Gava 28ccc2463e removed some cruft 2001-08-12 01:14:55 +00:00
Tim Peters a6a4f27ef7 _Condition.wait(): never sleep longer than the timeout time remaining,
and even if we have a long time left to wait, try the lock at least 20
times/second.
2001-08-12 00:41:33 +00:00
Jack Jansen dbc363ce35 The test assumed that the local pathname convention for "foo" would sort before "foo/bar", which is not true on the mac (where they are "foo" and ":foo:bar", respectively; ":foo" would be fine too, but "foo" is the preferred spelling). Fixed by sorting the output. 2001-08-11 23:22:43 +00:00
Jeremy Hylton d5d8fc559c Replace all type comparisons with isinstance() calls 2001-08-11 21:44:46 +00:00
Steven M. Gava c01e30f072 repair posix fonts fix 2001-08-11 15:48:13 +00:00
Martin v. Löwis 58682b7fe5 Only catch the errors that can actually occur, as reported in bug #411881. 2001-08-11 15:02:57 +00:00
Steven M. Gava abdfc4147d support for help menu changes 2001-08-11 07:46:26 +00:00
Steven M. Gava 5b3ac8f98f some re-design 2001-08-11 07:45:28 +00:00
Steven M. Gava 6b1ab255c2 supports about changes 2001-08-11 07:44:28 +00:00
Steven M. Gava 0ba4df89ab adjust help menu bindings 2001-08-11 07:42:37 +00:00
Fred Drake cd112f5546 Added tests for rich comparison operator functions.
Converted tests to PyUnit.
2001-08-11 03:21:35 +00:00
Guido van Rossum e45763a8e6 Add test for SF bug #442833 (multiple inheritance). 2001-08-10 21:28:46 +00:00
Guido van Rossum 61cf780b6d The message accompanying the TypeError exception on a readonly
attribute changed again.
2001-08-10 21:25:24 +00:00
Andrew M. Kuchling f4aa684132 [Bug #414032] Make the 'sdist' command work when the distribution contains
libraries.  This is done by adding a .get_source_files() method,
    contributed by Rene Liebscher and slightly modified.
Remove an unused local variable spotted by PyChecker
2001-08-10 20:24:33 +00:00
Guido van Rossum 6d94627f1e Allow AttributeError as well as TypeError for attribute-less objects. 2001-08-10 19:42:38 +00:00
Andrew M. Kuchling 13f4ea25d4 Remove unused variable 2001-08-10 19:00:41 +00:00
Andrew M. Kuchling 5079fe07fe Fix typo caught by PyChecker 2001-08-10 19:00:15 +00:00
Andrew M. Kuchling 665f248806 Add forgotten import 2001-08-10 18:59:59 +00:00
Fred Drake 981a1787b7 Wrap a comment to fit in 80 columns.
Use construction-syntax for an exception to make the argument easier
to read.
2001-08-10 18:59:30 +00:00
Andrew M. Kuchling db988b1ed3 Use .get_license() 2001-08-10 18:50:11 +00:00
Andrew M. Kuchling fa7dc57d6c [Bug #412271, bug #449009] Use 'license' as the attribute name,
though 'licence' is still supported for backward-compatibility
   (Should I add a warning to get_licence(), or not bother?)

Also fixes an UnboundLocalError noticed by PyChecker
2001-08-10 18:49:23 +00:00
Andrew M. Kuchling fcfc8d5c0e Patch #441091 from Finn Bock: the more advanced flush options are not
available in java, so only use the advanced flush options if they
  are defined in the zlib module.
2001-08-10 15:50:11 +00:00
Guido van Rossum 315cd29ecf Disable the sub() optimization until Fredrik has time to look into SF
bug #449000, "re.sub(r'\n', ...) broke".  This was Fredrik's
suggestion -- he's on vacation and said he wouldn't be able to work on
this until next week.
2001-08-10 14:56:54 +00:00
Guido van Rossum e056e4d15c Check in a testcase for SF bug #449000: re.sub(r'\n', ...) broke. 2001-08-10 14:52:48 +00:00
Jeremy Hylton a8b5f7d178 Remove hard-coded NT constants that are already defined in errno on NT.
Wrap some long lines.
Remove unnecessary tuple unpack.
2001-08-10 14:30:35 +00:00
Martin v. Löwis 9b75dca192 Expose nl_langinfo through locale where available. 2001-08-10 13:58:50 +00:00
Tim Peters ab9ba27dc0 Whitespace normalization. 2001-08-09 21:40:30 +00:00
Tim Peters c7ca3ffba3 Skip test_mhlib on Windows -- too many Unix assumptions. 2001-08-09 21:34:54 +00:00
Guido van Rossum e4deb959cc Fix two bugs detected by PyChecker: there's no need for redundant
"import MacOS", and there *is* a need for "import operator".
2001-08-09 21:22:15 +00:00
Andrew M. Kuchling 6386a4c846 Import UnknownFileError 2001-08-09 21:02:34 +00:00
Andrew M. Kuchling 106ffdb672 Import the errno module 2001-08-09 20:59:53 +00:00
Andrew M. Kuchling affadeb9fd Use correct variable name 2001-08-09 20:57:46 +00:00
Fred Drake eaa77e2ca1 Added tests for operator.floordiv() and operator.truediv(). 2001-08-09 20:23:08 +00:00
Guido van Rossum 3720261729 Restore the test for 'object' that I removed when object was
uninstantiable.  All is well now.
2001-08-09 19:45:21 +00:00
Guido van Rossum a995c91243 Use type(x).__name__ to get the name of the type instead of parsing
repr(type(x)).
2001-08-09 18:56:27 +00:00
Guido van Rossum 0263c80b90 Unittests for mhlib, by Nick Mathewson. 2001-08-09 18:18:08 +00:00
Tim Peters 55c12d4d5b SF patch #403640: incomplete proxy handling in URLLIB
Look specific to Windows.  Don't know whether it works.
2001-08-09 18:04:14 +00:00
Guido van Rossum f0713d3f4d SF Patch #420725 by Walter Doerwald:
For local files urllib.py doesn't return the MIME
  headers that the documentation says it does:

  http://www.python.org/doc/current/lib/module-
  urllib.html#l2h-2187 states that "When the method is
  local-file, returned headers will include a Date
  representing the file's last-modified time, a Content-
  Length giving file size, and a Content-Type containing
  a guess at the file's type"

  But in Python 2.1 the only header that gets returned
  is the Content-Type:

  >>> import urllib
  >>> f = urllib.urlopen("gurk.txt")
  >>> f.info().headers
  ['Content-Type: text/plain\n']
2001-08-09 17:43:35 +00:00
Martin v. Löwis c8718c13e8 Patch #403514: precompute _subst_format_str to avoid a call to
string.join() on each invocation of _bind.
2001-08-09 16:57:33 +00:00
Guido van Rossum 3c7a25a4d9 Applied SF patch #438424 by Josh Cogliati:
Python's logolike module turtle.py did not display
the turtle except when actually drawing lines.
This patch changes the turtle.py module so that
it displays the turtle at all times when tracing is
on. This is similar to the the way that logo works.
When tracing is off the turtle will not be displayed.
2001-08-09 16:42:07 +00:00
Martin v. Löwis dbdcb0fc3a Regenerate for glibc 2.2.3. 2001-08-09 12:48:17 +00:00
Martin v. Löwis 4414933f62 Regenerate for Solaris 8. 2001-08-09 12:33:32 +00:00
Martin v. Löwis 8cc965c1fb Patch #448474: Add support for tell() and seek() to gzip.GzipFile. 2001-08-09 07:21:56 +00:00
Guido van Rossum 64deef2b17 A test suite for binary operators, disguised as a rational number
class.
2001-08-08 22:27:20 +00:00
Greg Ward 034cbf1350 Typo fix (spelling mistake in error message). 2001-08-08 20:55:10 +00:00
Martin v. Löwis ff88556af6 Patch #449083: Use builtins to initalize the module. 2001-08-08 16:02:01 +00:00
Steve Purcell e00dde2087 Merged in bugfix from PyUnit CVS for problem reported by Gary Todd.
If 'unittest.py' was run from the command line with the name of a test
case class as a parameter, it failed with an ugly error. (Which was a
shame, because the documentation says you can do that.)

The problem was the old 'is the class X that you imported from me the same
as my class X?' gotcha.
2001-08-08 07:57:26 +00:00
Tim Peters a38d2608bc Regenerated token.py to account for new DOUBLESLASH and DOUBLESLASHEQUAL. 2001-08-08 06:35:56 +00:00
Guido van Rossum 96204f5e49 Add new tokens // and //=, in support of PEP 238. 2001-08-08 05:04:07 +00:00
Guido van Rossum 4668b000a1 Implement PEP 238 in its (almost) full glory.
This introduces:

- A new operator // that means floor division (the kind of division
  where 1/2 is 0).

- The "future division" statement ("from __future__ import division)
  which changes the meaning of the / operator to implement "true
  division" (where 1/2 is 0.5).

- New overloadable operators __truediv__ and __floordiv__.

- New slots in the PyNumberMethods struct for true and floor division,
  new abstract APIs for them, new opcodes, and so on.

I emphasize that without the future division statement, the semantics
of / will remain unchanged until Python 3.0.

Not yet implemented are warnings (default off) when / is used with int
or long arguments.

This has been on display since 7/31 as SF patch #443474.

Flames to /dev/null.
2001-08-08 05:00:18 +00:00
Steven M. Gava 074c9d2b20 beginning of work on the conf. handling smarts 2001-08-08 01:30:38 +00:00
Jeremy Hylton 54e99e8b3b Fix SF bug [ #447370 ] typo in urllib2.py
Also fix another bug caught by pychecker-- HTTPError() raised when
redirect limit exceed did not pass an fp object.  Had to change method
to keep fp object around until it's certain that the error won't be
raised.

Remove useless line in do_proxy().
2001-08-07 21:12:25 +00:00
Guido van Rossum 16fd3381d4 Apply two small changes to the Windows code, according to SF bug
#427345.  These are supposed to support binary data and avoid
buffering problems on Windows.
2001-08-07 19:55:10 +00:00
Fred Drake 56b5fdd295 Remove make_re() function; this is no longer needed since _sre and pcre
are now allowed by ok_builtin_modules.  This effectively backs out
revision 1.26.

This closes SF bug #448546.
2001-08-07 19:49:15 +00:00
Fred Drake c9fadf991c Add a test that xml.sax.saxutils.XMLGenerator does the right thing
when quoting attribute values that contain single & double quotes.

This provides the rest of the regression test for SF bug #440351.
2001-08-07 19:17:06 +00:00
Fred Drake dad91dd1e9 Make sure XMLGenerator uses quoteattr() instead of escape() to quote
attribute values.  Just using escape() can (and always has) led to broken
XML being generated.  This makes sure it always produces the right thing.

This actually closes SF bug #440351.
2001-08-07 19:14:46 +00:00
Guido van Rossum 288cd2cb69 Fix the test so it uses IterableUserDict for the "for x in dict" test. 2001-08-07 17:50:06 +00:00
Guido van Rossum 2050b65e84 Remove the __iter__ method from the UserDict class -- it can silently
break old code (in extreme cases).  See SF bug #448153.

Add a new subclass IterableUserDict that has the __iter__ method.

Note that for new projects, unless backwards compatibility with
pre-2.2 Python is required, subclassing 'dictionary' is recommended;
UserDict might become deprecated.
2001-08-07 17:40:42 +00:00
Guido van Rossum c5943b1c8c Add the NannyNag exception class and the process_tokens() function to
__all__, to indicate these are implied as part of the public API.

IDLE's "Check Module" command uses this, and it broke once already
because the reset_globals() and tokeneater() functions were deleted
when Neil converted this to using the generator API of tokenizer.
(See SF bug #448835.)
2001-08-07 17:19:25 +00:00
Guido van Rossum 15d86c6297 Remove the test for the 'object' type -- it can no longer be
instantiated.  (Its use as a base class is adequately tested by other
tests.)
2001-08-07 16:53:42 +00:00
Jeremy Hylton cd738364ce silence warnings about import * 2001-08-07 16:38:19 +00:00
Steven M. Gava 230e5789e5 more fleshing out, this time primarily the 'general' page 2001-08-07 03:28:25 +00:00
Piers Lauder e02f904cbf fix for Bug ID 448100 - "test code using NL instead of CRNL" 2001-08-05 10:43:03 +00:00
Steven M. Gava f213ccb5d1 began font / indentation page 2001-08-05 08:00:28 +00:00
Greg Ward cbce202f82 Hack to workaround bug #445984: attempt to import _socket before
starting the test suite proper.  If _socket fails to build, that will
make this test fail with an ImportError -- handled by the test harness
as "no such module _socket" -- instead of an AttributeError deep in
CGIHTTPServer.
2001-08-04 22:22:19 +00:00
Steven M. Gava 60fc707be5 further work on keybinding page 2001-08-04 13:58:22 +00:00
Tim Peters c173137391 Derived from SF patch #446899 Permit import of .pyw under Windows, from
David Bolen.
2001-08-04 08:12:36 +00:00
Fred Drake eeee4ec4f1 Refactor so that it is easier to work with alternate MIME types databases,
and programmatically extend the database in different ways.

This closes the SF bug (feature request) #439710.
2001-08-03 21:01:44 +00:00
Tim Peters e861365dab Don't use any characters C doesn't guarantee are safe for text-mode files.
This should stop the bizarre translations Jack was getting from Mac CVS.
2001-08-03 20:40:18 +00:00
Fred Drake 84bb9d8dc4 Fix stupid bug: when migrating these tests from the Zope repository, the
names of the test methods were not changed from the Zope-standard "check"
names to the Python-standard "test_" names, so the tests were not actually
being run.

Added test of hexadecimal character references as a regression check for
SF bug #445196.
2001-08-03 19:53:01 +00:00
Fred Drake 1d4601d306 Change some comments into docstrings.
Fix handling of hexadecimal character references (legal in XHTML) so that
they are properly interpreted as character references.
This fixes SF bug #445196.
2001-08-03 19:50:59 +00:00
Jack Jansen fffd7224df The test opened the binary test data files in text mode! Fixed. 2001-08-03 13:04:03 +00:00
Steven M. Gava 952d0a57d8 further work on config dialog, particularly highligthing config 2001-08-03 04:43:44 +00:00
Fred Drake 4fd06e0170 Make sure that WeakValueDictionary[] raises KeyError instead of TypeError
for keys that are not in the dictionary.
2001-08-03 04:11:27 +00:00
Fred Drake c916cdc5ca Miscellaneous minor cleanups. 2001-08-02 20:03:12 +00:00
Tim Peters d342c62961 This test failed under python -O.
rewrite_file():  Delete both .pyc and .pyo leftovers, and explicitly close
the new source file after writing to it.
2001-08-02 17:23:11 +00:00
Guido van Rossum 394a47b268 Unit test for improved package import semantics.
Original by Alex Coventry (in SF patch #441791), adapted to the
standard regression test framework.
2001-08-02 14:14:20 +00:00
Martin v. Löwis 02d893cfae Patch #444359: Remove unused imports. 2001-08-02 07:15:29 +00:00
Tim Peters 6d6c1a35e0 Merge of descr-branch back into trunk. 2001-08-02 04:15:00 +00:00
Tim Peters 722d78f18a s/endswith/startswith/ 2001-08-01 20:23:18 +00:00
Tim Peters 66e1a254a1 Rewritten version of Finn Bock's SF patch #446907 (Allow jython to
complete test_import).
2001-08-01 19:38:56 +00:00
Guido van Rossum b363c1f445 Turn an octal constant into a hex constant. 2001-08-01 18:17:23 +00:00
Steven M. Gava b9d07b5a8b A more lightweight (and read only) way to view help text
until the new help system is implemented. Removed some
commented cruft.
2001-07-31 11:11:38 +00:00
Steven M. Gava d721c48165 indentation style changed to match existing source 2001-07-31 10:46:53 +00:00
Steven M. Gava 885c0bbd54 improve viewfile handling
indentation style changed to match existing source
2001-07-31 10:44:35 +00:00
Martin v. Löwis 6cd441d129 Add dead imports of modules that are "magically" imported. 2001-07-31 08:54:55 +00:00
Martin v. Löwis bbe500e5d3 Remove obsolete entries from regen scripts. 2001-07-31 08:47:55 +00:00
Martin v. Löwis 2ad2569c72 Initialize msg to avoid unbound locals. 2001-07-31 08:40:21 +00:00
Steven M. Gava 7d9ed726fb activate new about dialog for testing 2001-07-31 07:01:47 +00:00
Steven M. Gava 646c65c117 removed redundant separate idlfefork ver 2001-07-31 07:00:39 +00:00
Steven M. Gava 44d3d1a394 some new dialogs and support files for new about and configuration implementations 2001-07-31 06:59:02 +00:00
Guido van Rossum 3fc9582821 Amazing. This would open the sound file in text mode. Fixed.
SF bug  #446219.
2001-07-31 06:27:07 +00:00
Tim Peters 108efac24e test_codeup should not have had an expected-output file; removing it. 2001-07-30 23:10:44 +00:00
Jeremy Hylton b7a7731e01 Add tests for getattr() and hasattr() with non-string args 2001-07-30 22:49:11 +00:00
Fred Drake c974bf4dc2 Get the whitespace right! 2001-07-30 22:41:23 +00:00
Jeremy Hylton 5121e7de11 Fix for SF bug [ #443866 ] Evaluating func_code causing core dump
Add test that calls eval with a code object that has free variables.
2001-07-30 21:55:29 +00:00
Jeremy Hylton e3c37d660f Ugly fix used when pyexpat is not available.
If pyexpat is not available and more than one attempt is made to load
an expat-based xml parser, an empty xml.parser.expat module will be
created.  This empty module will confuse xml.sax.expatreader into
thinking that pyexpat is available.

The ugly fix is to verify that the expat module actually defines the
names that are imported from pyexpat.
2001-07-30 21:49:22 +00:00
Jeremy Hylton 3c19ec4eab Fix when pyexpat not built
Import pyexpat first so that import error occurs when it is not
available.
2001-07-30 21:47:25 +00:00
Martin v. Löwis 3bd071e3f7 Patch #442866: Tests for codeop.py. 2001-07-30 12:30:08 +00:00
Martin v. Löwis 27c430e54e Patch #445538: add completion for pstats.py sort cmd. 2001-07-30 10:21:13 +00:00
Just van Rossum 8d8e7a3256 Do convert_path() on script paths (now PyXML builds out of the box
under MacOS.)
2001-07-29 21:39:18 +00:00
Martin v. Löwis 70195da3ff Patch #443337: Fix incompatibilities in imputil's behavior. 2001-07-28 20:33:41 +00:00
Martin v. Löwis d3011cd1d3 Remove usage of strop module. 2001-07-28 17:59:34 +00:00
Martin v. Löwis 66b6e192b9 Patch #416224: add readline completion to cmd.Cmd. 2001-07-28 14:44:03 +00:00
Tim Peters 33dc0a1705 One more crack at join(): stop trying to pretend this isn't a mass of
special cases.  test_pkg works again on Windows.
2001-07-27 08:09:54 +00:00
Tim Peters 4223f89edd Change ntpath.join() so that join("d:/", "/whatever") returns
d:/whatever instead of /whatever.  While I'm afraid changing isabs()
to be *consistent* with this would break lots of code, it makes
best sense for join() to do it this way.  Thanks to Alex Martelli for
pushing back on this one!
2001-07-26 21:54:37 +00:00
Tim Peters 7321ec437b SF bug #444510: int() should guarantee truncation.
It's guaranteed now, assuming the platform modf() works correctly.
2001-07-26 20:02:17 +00:00
Marc-André Lemburg 7cf92fa1c8 Add backwards compatibility. 2001-07-26 18:06:58 +00:00
Martin v. Löwis 4f1cd8bdcb Patch #411138: Rename config.h to pyconfig.h. Closes bug #231774. 2001-07-26 13:41:06 +00:00
Martin v. Löwis 4eb5940a4d Untabify IPv6 changes. 2001-07-26 13:37:33 +00:00
Guido van Rossum 2e441f7836 Fix a denial-of-service attack, SF bug #443120.
Code by Evan Simpson.
2001-07-25 21:00:19 +00:00
Greg Ward 7cf7e7e529 Undo revision 1.7: always mangle a #! line containing "python" to point
to the current Python interpreter (ie. the one used for
building/installation), even (especially!) if "/usr/bin/env" appears in
the #! line.

Rationale: installing scripts with "#!/usr/bin/env python" is asking for
trouble, because
  1) it might pick the wrong interpreter (not the one used to
     build/install the script)
  2) it doesn't work on all platforms (try it on IRIX 5, or on Linux
     with command-line options for python)
  3) "env" might not be in /usr/bin
2001-07-25 20:20:11 +00:00
Greg Ward e628a2fa85 Don't "import *" from stat at all -- just import what's needed, and
do it back in copy_file() (not at module level).
2001-07-25 19:48:03 +00:00
Marc-André Lemburg 80d1dd5f3b Fix for bug #444493: u'\U00010001' segfaults with current CVS on
wide builds.
2001-07-25 16:05:59 +00:00
Martin v. Löwis 1669669f4c Remove unused imports from previous checkin. 2001-07-25 06:12:16 +00:00
Martin v. Löwis a43c2f845e Patch #401196: Use getaddrinfo and AF_INET6 in TCP servers and clients. 2001-07-24 20:34:08 +00:00
Fred Drake 5e9eb98ff6 Oh, ok, so plainpager is probably marginally better. 2001-07-23 19:48:10 +00:00
Fred Drake 0a66fcb116 If $TERM is "dumb" or "emacs", just dump the text instead of trying to run
"less".
Patch contributed by Alex Convertry.
This closes SF patch #443551.
2001-07-23 19:44:30 +00:00
Fred Drake f973c6d594 Make this test work under Windows as well. 2001-07-23 16:30:21 +00:00
Fred Drake 99e87f9e23 Test for the "glob" module, contributed by Nick Mathewson.
Heavily modified so this doesn't break on Windows.
This closes SF patch #441175.
2001-07-23 16:08:36 +00:00
Tim Peters fa712ca1ed Whitespace normalization.
Note:  This test fails on Windows.  Don't know why yet.
2001-07-23 09:44:21 +00:00
Fred Drake 4c81d60fcb Tests for the "commands" module, contributed by Nick Mathewson.
This closes SF patch #440291.
2001-07-23 04:08:01 +00:00
Fred Drake 1586136193 New tests by Nick Mathewson, for the fpformat module.
This closes SF patch #440290.
2001-07-23 02:46:35 +00:00
Steven M. Gava ba247a6bbb updated about info for 0.8.1 release 2001-07-21 09:59:58 +00:00
Steven M. Gava 88ff736ee2 new material for 0.8.1 release 2001-07-21 09:50:55 +00:00
Tim Peters 137759407b On WIndows, skip the part of test_dircache that can't work on Windows. 2001-07-21 02:22:14 +00:00
Tim Peters 87cc0c329e Whitespace normalization, plus:
+ test_quopri.py relied on significant trailing spaces.  Fixed.
+ test_dircache.py (still) doesn't work on Windows (directory mtime on
  Windows doesn't work like it does on Unix).
2001-07-21 01:41:30 +00:00
Fred Drake 7f5296e7c0 Make the add*() helper functions more robust for use after intialization
is complete:  recompute _dirs_in_sys_path each time these functions are
entered after module initialization is complete, and reset before
returning to user code.

This closes SF patch #442983.
2001-07-20 20:06:17 +00:00
Andrew M. Kuchling 5a3e4cb0a2 Patch #429442 from Jason Tishler: Corrects sys.platform and
distutils.util.get_platform() problems caused by the cruft contained
    in Cygwin's uname -s.
2001-07-20 19:29:04 +00:00
Fred Drake 79e75e1916 Use string.ascii_letters instead of string.letters (SF bug #226706). 2001-07-20 19:05:50 +00:00
Fred Drake 0f715d2aa1 Use string.ascii_letters instead of string.letters (SF bug #226706).
Work-around a font-lock bogosity.
2001-07-20 18:53:34 +00:00
Fred Drake 27eebb8c76 Use string.ascii_letters instead of string.letters.
Remove unused import.
2001-07-20 18:52:02 +00:00
Fred Drake 960fdf9ac3 Added the constants ascii_letters, ascii_lowercase, and ascii_uppercase
to the string module.  This was determined to be the right approach in
SF bug #226706.
2001-07-20 18:38:26 +00:00
Marc-André Lemburg 6c6bfb7c70 Make the unicode-escape and the UTF-16 codecs handle surrogates
correctly and thus roundtrip-safe.

Some minor cleanups of the code.

Added tests for the roundtrip-safety.
2001-07-20 17:39:11 +00:00
Guido van Rossum 27451d0fc8 Copying this 2.1.1 bugfix to the trunk:
Fix showstopper SF bug #442983: use of site.addsitedir() was broken
because it references the global dirs_in_sys_path which is deleted.
The fix avoids deleting that global.

(My email through python.org or digicool.com is non-functional at the
moment; use gvanrossum@home.com to reach me.)
2001-07-20 14:57:12 +00:00
Piers Lauder 15e5d5344d apply patch item #416253 2001-07-20 10:52:06 +00:00
Piers Lauder 34d9705943 fix missed conversion in ESR's string conversion 2001-07-20 10:28:51 +00:00
Steven M. Gava fae9fb197b update in preparation for 0.8.1 alpha release 2001-07-20 08:53:38 +00:00
Steven M. Gava d39993ef9d bring up to date for 0.8.1 release 2001-07-20 01:36:49 +00:00
Fred Drake 84073bfdb0 Regression test for the dircache module, contributed by Nick Mathewson.
Modified by Fred Drake.
This closes SF patch #440827.
2001-07-19 22:59:09 +00:00
Fred Drake 8e6669ad05 Test for the repr module, contributed by Nick Mathewson.
This closes SF patch #440826.
2001-07-19 22:27:56 +00:00
Fred Drake 390e9dbd4f Make the new docstrings better conform to Guido's style guide. 2001-07-19 20:57:23 +00:00
Fred Drake 08f8dd6d0c Added docstrings based on a patch by Evelyn Mitchell.
This closes SF patch #440153.
2001-07-19 20:08:04 +00:00
Fred Drake a58947f600 Make sure path names inserted into ZIP files are normalized to use "/" as
the directory separator, as required by the format specification.

This closes SF bug #440693.
2001-07-19 19:44:25 +00:00
Tim Peters d4f7f609bf Add some test cases for ntpath.join(). 2001-07-19 19:11:41 +00:00
Tim Peters 3b5e4d1e3c Cosmetic: break the long lines in test_ntpath.py, and get rid of its
expected-output file.
2001-07-19 19:02:12 +00:00
Tim Peters 1bdd0f2559 SF bug #44271: os.path.expanduser problem w/o HOME set.
This is a Windows-specific glitch that's really due to that, e.g.,
ntpath.join("c:", "/abc") returned "/abc" instead of "c:/abc".  Made
join smarter.
Bugfix candidate.
2001-07-19 17:18:18 +00:00
Fred Drake acd32d3be5 Added function xml.sax.saxutils.quoteattr().
This closes SF bug #440351.  It should not be moved to Python 2.1.1.
2001-07-19 16:10:15 +00:00
Martin v. Löwis 3550dd30bb Patch #442512: put block indices in the right byte order on bigendian systems. 2001-07-19 14:26:10 +00:00
Martin v. Löwis d0cd95ce7f Replace __import__ with import as. 2001-07-19 10:06:39 +00:00
Steven M. Gava 4d712a4d67 minor tidy-ups ready for 0.8.1 alpha tarball release 2001-07-19 04:49:13 +00:00
Fred Drake 3f8f1643c8 Remove some false comments.
Reorganize so the initialization sequences does not bite us in the foot.
(There is no good reason to discard classes that clients may want to
subclass.)
2001-07-19 03:46:26 +00:00
Skip Montanaro cdab3bf7eb If the user's environment has set the BROWSER environment variable (as Gnome
seems to do), the user may not be aware of its contents.  Attempt to add any
to _browsers.

closes bug #429136
2001-07-18 20:03:32 +00:00
Fred Drake 70b014d3d3 Minor changes for stylistic cleanliness and consistency. 2001-07-18 18:39:56 +00:00
Martin v. Löwis 984158d25b Patch #432117: Record namespaces in the DOM tree using the DOM xmlns prefix. 2001-07-18 15:30:25 +00:00
Fred Drake 1f4cc897f8 Remove a couple of lines from the test that proved not to be portable to
all platforms that offer tempnam().
2001-07-17 21:56:01 +00:00
Fred Drake 38c2ef0a4c Start of a test suite for the "os" module -- this only tests the temporary
file management functions that have just been made available on more
platforms.
2001-07-17 20:52:51 +00:00
Fred Drake 6e4f2c09df Use the "st" versions of the "ast" calls in the parser module -- there is
no reason to pretend the syntax trees we're dealing with are abstract.
2001-07-17 19:33:25 +00:00
Guido van Rossum b1a77dd248 Deleting zombies 2001-07-17 15:45:08 +00:00
Kurt B. Kaiser 59e07bde96 INSTALLATION: Remove the coexist.patch instructions
****************
setup.py:

Remove the idles script, add some words on IDLE Fork to the
long_description, and clean up some line spacing.
2001-07-17 05:12:42 +00:00
Kurt B. Kaiser c9a4215482 Put this in the attic, at least for now... 2001-07-17 05:01:04 +00:00
Kurt B. Kaiser 96d8842237 Implement idle command interface as suggested by GvR [idle-dev] 16 July
****************
PyShell: Added functionality:

usage: idle.py [-c command] [-d] [-i] [-r script] [-s] [-t title] [arg] ...

idle file(s)    (without options) edit the file(s)

-c cmd     run the command in a shell
-d         enable the debugger
-i         open an interactive shell
-i file(s) open a shell and also an editor window for each file
-r script  run a file as a script in a shell
-s         run $IDLESTARTUP or $PYTHONSTARTUP before anything else
-t title   set title of shell window

Remaining arguments are applied to the command (-c) or script (-r).

******************
idles: Removed the idles script, not needed

******************
idle:  Removed the IdleConf references, not required anymore
2001-07-17 04:59:01 +00:00
Fred Drake cf580c7ea1 Added tests for the new yield support in the parser module.
(Should be merged with descr branch.)
2001-07-17 03:01:29 +00:00
Tim Peters 861adac23e This has never worked on Windows. Now it does. If it breaks on Unix now,
great, it's your turn to watch it fail for months <0.9 wink>.
2001-07-16 20:49:49 +00:00
Barry Warsaw 06069330e3 test_basic(): Add a test for "person@dom.ain (User J. Person)" which
was already correctly parsed (contrary to a comment in Mailman).

test_rfc2822_phrases(): RFC 2822 now requires that we allow `.' in
phrases, which means we must accept dots in unquoted realname parts.
Add a test to check the change in rfc822.py 1.58.
2001-07-16 20:44:16 +00:00
Barry Warsaw b8a55c00d5 Stoopid change, just to mention that the last checkin resolves SF bug
#437395
2001-07-16 20:41:40 +00:00
Barry Warsaw 9ec58aaef2 Fix address parsing to be RFC 2822 conformant. Specifically, dots are
now allowed in unquoted RealName areas (technically, they are defined
as "obsolete syntax" we MUST accept in phrases, as part of the
obs-phrase production).  Thus, parsing

    To: User J. Person <person@dom.ain>

correctly returns "User J. Person" as the RealName.

AddrlistClass.__init__(): Add definition of self.phraseends which is
just self.atomends with `.' removed.

getatom(): Add an optional argument `atomends' which, if None (the
default) means use self.atomends.

getphraselist(): Pass self.phraseends to getatom() and break out of
the loop only when the current character is in phraseends instead of
atomends.  This allows dots to continue to serve as atom delimiters in
all contexts except phrases.

Also, loads of docstring updates to document RFC 2822 conformance
(sorry, this should have been two separate patches).
2001-07-16 20:40:35 +00:00
Fred Drake 19ff4ac7e9 Add a unit test for sgmllib (needs work, but has already caught problems).
Based on the test for the HTMLParser module.
2001-07-16 18:52:40 +00:00
Fred Drake 14f6c18b62 Give more useful information about a failing PyUnit-style test. 2001-07-16 18:51:32 +00:00
Fred Drake 50bc19fce5 Remove a duplicate test. 2001-07-16 18:50:29 +00:00
Tim Peters 03813399cc Document doctest's generator-future hack. 2001-07-16 18:39:58 +00:00
Fred Drake fb38c76e0f In CDATA mode, make sure entity-reference syntax is not interpreted;
entity references are not allowed in that mode.

Do a better job of scanning <!DOCTYPE ...> declarations; based on the
code in HTMLParser.py.
2001-07-16 18:30:35 +00:00
Guido van Rossum 63a47402b3 Fix a mismatched parenthesis in the last patch. 2001-07-16 14:46:13 +00:00
Andrew M. Kuchling 286b107bea [Bug #441527] Fixes for preprocessor support, contributed by Tarn
Weisner Burton
2001-07-16 14:19:20 +00:00
Kurt B. Kaiser d65ca7231a Added installation instructions.
Added a patch which modifies idlefork so that it can co-exist with
"official" IDLE in the site-packages directory. This patch is not
necessary if only idlefork IDLE is installed. See INSTALLATION for further
details.
2001-07-16 07:08:20 +00:00
Kurt B. Kaiser 91e476f297 Add a script "idles" which opens a Python Shell window.
The default behaviour of idlefork idle is to open an editor window instead
of a shell. Complex expressions may be run in a fresh environment by
selecting "run".  There are times, however, when a shell is desired.
Though one can be started by "idle -t 'foo'", this script is more
convenient.  In addition, a shell and an editor window can be started
in parallel by "idles -e foo.py".
2001-07-16 05:50:45 +00:00
Tim Peters fe2127d3cb Ugly. A pile of new xxxFlags() functions, to communicate to the parser
that 'yield' is a keyword.  This doesn't help test_generators at all!  I
don't know why not.  These things do work now (and didn't before this
patch):

1. "from __future__ import generators" now works in a native shell.

2. Similarly "python -i xxx.py" now has generators enabled in the
   shell if xxx.py had them enabled.

3. This program (which was my doctest proxy) works fine:

from __future__ import generators

source = """\
def f():
    yield 1
"""

exec compile(source, "", "single") in globals()
print type(f())
2001-07-16 05:37:24 +00:00
Kurt B. Kaiser e75785a646 Call out IDLE Fork in startup message. 2001-07-16 05:25:12 +00:00
Kurt B. Kaiser 21ebb211df Add a script "idles" which opens a Python Shell window.
The default behaviour of idlefork idle is to open an editor window instead
of a shell. Complex expressions may be run in a fresh environment by
selecting "run".  There are times, however, when a shell is desired.
Though one can be started by "idle -t 'foo'", this script is more
convenient.  In addition, a shell and an editor window can be started
in parallel by "idles -e foo.py".
2001-07-16 04:00:10 +00:00
Tim Peters 5ba5866281 Part way to allowing "from __future__ import generators" to communicate
that info to code dynamically compiled *by* code compiled with generators
enabled.  Doesn't yet work because there's still no way to tell the parser
that "yield" is OK (unlike nested_scopes, the parser has its fingers in
this too).
Replaced PyEval_GetNestedScopes by a more-general
PyEval_MergeCompilerFlags.  Perhaps I should not have?  I doubted it was
*intended* to be part of the public API, so just did.
2001-07-16 02:29:45 +00:00
Guido van Rossum b09f7ed623 Preliminary support for "from __future__ import generators" to enable
the yield statement.  I figure we have to have this in before I can
release 2.2a1 on Wednesday.

Note: test_generators is currently broken, I'm counting on Tim to fix
this.
2001-07-15 21:08:29 +00:00
Kurt B. Kaiser 0765976cc4 tabnanny and pyclbr are now found in /Lib 2001-07-14 17:06:13 +00:00
Kurt B. Kaiser 03b75dc007 Remove, was retained for 1.5.2 support 2001-07-14 16:29:46 +00:00
Fred Drake 8600b47b61 Be more permissive in what is accepted as an attribute name; this makes
this module slightly more resiliant in the face of XHTML input, or just
colons in attribute names.
2001-07-14 05:50:33 +00:00
Kurt B. Kaiser 3eb78609c0 Installing Idle to site-packages via Distutils does not
copy the Idle help.txt file.

Ref SF Python Patch 422471
2001-07-14 05:48:44 +00:00
Kurt B. Kaiser b7651761bf py-cvs-2001_07_13 (Rev 1.3) merge
"Make copy, cut and paste events case insensitive.  Reported by Patrick
K. O'Brien on idle-dev. (Should other bindings follow suit?)" --GvR
2001-07-14 05:26:23 +00:00
Kurt B. Kaiser 7711b5f432 py-cvs-2001_07_13 (Rev 1.4) merge
"Move the action of loading the configuration to the IdleConf module
rather than the idle.py script.  This has advantages and
disadvantages; the biggest advantage being that we can more easily
have an alternative main program."  --GvR
2001-07-14 05:21:37 +00:00
Kurt B. Kaiser 40610547be py-cvs-2001_07_13 (Rev 1.4) merge
"Quick update to the extension mechanism (extend.py is gone, long live
config.txt)" --GvR
2001-07-14 05:18:59 +00:00
Kurt B. Kaiser a4c9be88c6 py-cvs-2001_07_13 (Rev 1.16) merge
"Refactored, with some future plans in mind. This now uses the new
gotofileline() method defined in FileList.py"  --GvR
2001-07-14 05:15:29 +00:00
Kurt B. Kaiser bb6b1e9b26 py-cvs-2001_07_13 (Rev 1.34) merge
"Amazing.  A very subtle change in policy in descr-branch actually
found a bug here.  Here's the deal: Class PyShell derives from class
OutputWindow.  Method PyShell.close()
wants to invoke its parent method, but because PyShell long ago was
inherited from class PyShellEditorWindow, it invokes
PyShelEditorWindow.close(self).  Now, class PyShellEditorWindow itself
derives from class OutputWindow, and inherits the close() method from
there without overriding it.  Under the old rules,
PyShellEditorWindow.close would return an unbound method restricted to
the class that defined the implementation of close(), which was
OutputWindow.close.  Under the new rules, the unbound method is
restricted to the class whose method was requested, that is
PyShellEditorWindow, and this was correctly trapped as an error." --GvR
2001-07-14 05:10:34 +00:00
Kurt B. Kaiser 752e4d5531 py-cvs-2001_07_13 (Rel 1.9) merge
"Taught IDLE's autoident parser that "yield" is a keyword that begins a
stmt.  Along w/ the preceding change to keyword.py, making all this
work w/ a future-stmt just looks harder and harder." --tim_one

(From Rel 1.8: "Hack to make this still work with Python 1.5.2.  ;-( "
--fdrake)
2001-07-14 04:59:24 +00:00
Kurt B. Kaiser 8bf5b2027a py-cvs-2001_07_13 (Rel 1.7) merge
"Move the action of loading the configuration to the IdleConf module
rather than the idle.py script.  This has advantages and
disadvantages; the biggest advantage being that we can more easily
have an alternative main program." --GvR
2001-07-14 04:51:06 +00:00
Kurt B. Kaiser df8a40fbf5 py-cvs-2000_07_13 (Rev 1.9) merge
"Delete goodname() method, which is unused. Add gotofileline(), a
convenience method which I intend to use in a
variant. Rename test() to _test()."  --GvR

This was an interesting merge. The join completely missed removing
goodname(), which was adjacent, but outside of, a small conflict.
I only caught it by comparing the 1.1.3.2/1.1.3.3 diff.  CVS ain't
infallible.
2001-07-14 04:45:32 +00:00
Kurt B. Kaiser fd182cd9d3 py-cvs-2000_07_13 (Rev 1.38) merge
"Remove legacy support for the BrowserControl module; the webbrowser
module has been included since Python 2.0, and that is the preferred
interface." --fdrake
2001-07-14 03:58:25 +00:00
Kurt B. Kaiser 4796c65952 py-cvs-rel2_1 (Rev 1.2) merge
Copied py-cvs rev 1.2 changed file to idlefork MAIN
2001-07-14 02:02:36 +00:00
Kurt B. Kaiser 1313833113 py-cvs-rel2_1 (Rev 1.2) merge
Copied py-cvs 1.2 changed file to idlefork MAIN
2001-07-14 01:58:10 +00:00
Kurt B. Kaiser bdaac36d00 py-cvs-rel2_1 (rev 1.5) merge - whitespace normalization 2001-07-14 01:23:30 +00:00
Kurt B. Kaiser f61eb42988 py-cvs-rel2_1 (Rev 1.3) merge - whitespace normalization 2001-07-14 01:20:05 +00:00
Kurt B. Kaiser fcd44ec5ea py-cvs-rel2_1 (Rev 1.15) merge - whitespace normalization 2001-07-14 01:16:56 +00:00
Kurt B. Kaiser d5338a8f99 py-cvs-rel2_1 (Rev 1.2) merge - whitespace normalization 2001-07-14 01:14:09 +00:00
Kurt B. Kaiser 94bd77415f cvs-py-rel2_1 (Rev 1.29 - 1.33) merge
Merged the following py-cvs revs without conflict:
1.29 Reduce copyright text output at startup
1.30 Delay setting sys.args until Tkinter is fully initialized
1.31 Whitespace normalization
1.32 Turn syntax warning into error when interactive
1.33 Fix warning initialization bug

Note that module is extensively modified wrt py-cvs
2001-07-14 00:13:28 +00:00
Kurt B. Kaiser 3269cc8bd1 py-cvs-rel2_1 (Rev 1.6 - 1.8) merge
Fix autoindent bug and deflect Unicode from text.get()
2001-07-13 20:33:46 +00:00
Kurt B. Kaiser 48b03144ec py-cvs-rel2_1 (Rev 1.3)
"move "from Tkinter import *" to module level" --jhylton
2001-07-13 20:00:15 +00:00
Kurt B. Kaiser bec5e5cb90 py-cvs-rel2_1 (Rev 1.6) merge - whitespace normalization 2001-07-13 19:57:00 +00:00
Kurt B. Kaiser 4d4d212325 cvs-py-rel2_1 (Rev 1.5) merge - whitespace normalization 2001-07-13 19:49:27 +00:00
Guido van Rossum 6e735c98dc Updated this file to match reality.
Thanks Shane for pointing this out!
2001-07-13 18:05:46 +00:00
Kurt B. Kaiser 6a945a5904 py-cvs-rel2_1 (Rev 1.3) merge
"Make the test program work outside IDLE."  -- GvR
2001-07-13 17:57:37 +00:00
Kurt B. Kaiser 8220fdda75 py-cvs-rel2_1 (Rev 1.2) merge - whitespace normalization 2001-07-13 17:52:08 +00:00
Kurt B. Kaiser 233bf2c563 py-cvs-rel2_1 (Rev 1.2) merge - whitespace normalization 2001-07-13 17:44:06 +00:00
Kurt B. Kaiser 4e32e7e567 py-cvs-rel2_1 (Rev 1.4) merge - whitespace normalization 2001-07-13 17:40:17 +00:00
Kurt B. Kaiser 7717ad6817 py-cvs-rel2_1 (Rev 1.6) merge - whitespace normalization 2001-07-13 17:38:08 +00:00
Guido van Rossum 0960015056 Should raise TestSkipped, not ImportError, when deciding to skip the
test.
2001-07-13 17:27:57 +00:00
Tim Peters 9a8c8e270b Having fun on my own time: quicker flat_conjoin; Knights Tour solver
simplified and generalized to rectangular boards.
2001-07-13 09:12:12 +00:00
Kurt B. Kaiser 7eea271464 py-cvs-rel2_1 (Rev 1.4) merge - move "import *" to module level 2001-07-13 04:18:32 +00:00
Kurt B. Kaiser 0e5fb0a618 py-cvs-rel2_1 (Rev 1.9) merge - whitespace normalization 2001-07-13 04:12:02 +00:00
Kurt B. Kaiser 6be679047b py-cvs-rel2_1 (Rev 1.8) merge - whitespace normalization 2001-07-13 04:07:47 +00:00
Kurt B. Kaiser afdf71b9ee py-cvs-rel2_1 (Rev 1.33 - 1.37) merge
VP IDLE version depended on VP's ExecBinding.py and spawn.py to get the
path to the Windows Doc directory (relative to python.exe). Removed this
conflicting code in favor of py-cvs updates which on Windows use a hard
coded path relative to the location of this module. py-cvs updates include
support for webbrowser.py.  Module still has BrowserControl.py for 1.5.2
support.

At this point, the differences wrt py-cvs relate to menu functionality.
2001-07-13 03:35:32 +00:00
Kurt B. Kaiser a3253d70bc py-cvs-rel2_1 merge - Remove, lives in /Lib 2001-07-13 01:30:07 +00:00
Kurt B. Kaiser 628b362886 py-cvs-rel2_1 (Rev 1.3) merge - whitespace normalization 2001-07-13 00:10:02 +00:00
Kurt B. Kaiser 5291d46755 py-cvs-rel2_1 (Rev 1.15) merge - whitespace normalization 2001-07-13 00:07:42 +00:00
Kurt B. Kaiser 6df4bf2864 py-cvs-rel2_1 (Rev 1.11 and 1.12) merge
Colorize "as" after "import" / use DEBUG instead of __debug__
2001-07-13 00:04:24 +00:00
Kurt B. Kaiser d6c4c9e846 py-cvs-rel2_1 (Rev 1.12) merge - whitespace normalization 2001-07-12 23:54:20 +00:00
Kurt B. Kaiser ae67647ab7 py-cvs-rel2_1 (Rev 1.8) merge - whitespace normalization 2001-07-12 23:10:35 +00:00
Tim Peters a1d545523d Remove the last remnants of the hacks to worm around leaks. 2001-07-12 22:55:42 +00:00
Tim Peters 3446365c37 Repair flawed example. 2001-07-12 22:43:41 +00:00
Tim Peters c4889c496a Remove now-unnecessary "from __future__ import nested_scopes" stmts. 2001-07-12 22:36:02 +00:00
Kurt B. Kaiser 9a1ae1a960 py-cvs-rel2_1 (Rev 1.3) merge - whitespace normalization 2001-07-12 22:26:44 +00:00
Kurt B. Kaiser 180b6be18c py-cvs-rel1_2 (Rev 1.4) merge,
"Add Alt-slash to Unix keydefs (I somehow need it on RH 6.2).
Get rid of assignment to unused self.text.wordlist."  --GvR
2001-07-12 22:13:51 +00:00
Fred Drake fd4ff52c22 Actually remove directories from sys.path if they do not exist; the intent
is to avoid as many stat() calls as we can.
2001-07-12 21:08:33 +00:00
Neil Schemenauer b20e9dbf89 Remove reference cycle breaking code. The GC now takes care of it. 2001-07-12 13:26:41 +00:00
Neil Schemenauer 88c761a117 Test GC of frame objects. 2001-07-12 13:25:53 +00:00
Guido van Rossum 28358fbed6 Make the test pass now that 10**-15 returns a float instead of raising
an exception.
2001-07-12 12:51:22 +00:00
Steven M. Gava e9880c81b9 py-cvs merge, python 1.5.2 compatability 2001-07-12 06:54:16 +00:00
Steven M. Gava 42f6c64816 py-cvs merge, better error dialog 2001-07-12 06:46:53 +00:00
Steven M. Gava 9713992bad py-cvs merge, additions 2001-07-12 06:38:24 +00:00
Steven M. Gava 817a76cfbb py-cvs merge, correct indentation 2001-07-12 05:35:17 +00:00
Steven M. Gava fc0386cc5a py-cvs merge, correct typo 2001-07-12 05:24:19 +00:00
Steven M. Gava 569b17f414 py-cvs merge, update colour changing info 2001-07-12 05:21:08 +00:00
Tim Peters 6a479f5488 PEP 250: Add lib/site-packages to sys.path on Windows; also sys.prefix
to sys.path if os.sep == ':' (Macs?).  See PEP 250.
2001-07-12 05:20:13 +00:00
Steven M. Gava 9fe8828cbf py-cvs merge, idle_dir loading changed 2001-07-12 04:51:11 +00:00
Steven M. Gava ba910c1e92 py-cvs merge, version update 2001-07-12 04:44:48 +00:00
Tim Peters 3230d5c961 SF patch #440170: Tests for fileinput module.
New test_fileinput.py from Nick Mathewson, fiddled to use TESTFN and sundry
style nits.
2001-07-11 22:21:17 +00:00
Tim Peters 48dacc69a2 SF patch #440144: Tests and minor bugfix for uu module.
New test_uu.py from Nick Mathewson, fiddled to work on Windows too.
Somebody should check that it still works on non-Windows boxes, though!
2001-07-11 21:43:42 +00:00
Fredrik Lundh b905633be0 xmlrpclib for python 2.2; initial checkin 2001-07-11 17:42:21 +00:00
Tim Peters 79c8671c7a SF patch #440144: Tests and minor bugfix for uu module
decode():  While writing tests for uu.py, Nick Mathewson discovered
that the 'Truncated input file' exception could never get raised,
because its "if not str:" test was actually testing the builtin
function "str", not the local string vrbl "s" as intended.

Bugfix candidate.
2001-07-11 04:08:49 +00:00
Kurt B. Kaiser 9178af1455 Initial revision 2001-07-11 02:53:57 +00:00
Guido van Rossum 05be1a0fd6 Ported to Windows:
- Set the host to "localhost" instead of "".

- Skip the AF_UNIX tests when socket.AF_UNIX is not defined.
2001-07-10 15:46:34 +00:00
Guido van Rossum 39f1b3656e A test suite for SocketServer.py that exposes the various bugs just
fixed.  Regrettably, this must be run manually -- somehow the I/O
redirection of the regression test breaks the test.  When run under
the regression test, this raises ImportError with a warning to that
effect.

Bugfix candidate!
2001-07-10 11:52:38 +00:00
Guido van Rossum 7de4d645a5 IMPORTANT FIX: This should definitely go into the 2.1.1 release!!!
Fix various serious problems:

- The ThreadingTCPServer class and its derived classes were completely
  broken because the main thread would close the request before the
  handler thread had time to look at it.  This was introduced by
  Ping's close_request() patch.  The fix moves the close_request()
  calls to after the handler has run to completion in the BaseServer
  class and the ForkingMixIn class; when using the ThreadingMixIn,
  closing the request is the handler's responsibility.

- The ForkingUDPServer class has always been been broken because the
  socket was closed in the child before calling the handler.  I fixed
  this by simply not calling server_close() in the child at all.

- I cannot get the UnixDatagramServer class to work at all.  The
  recvfrom() call doesn't return a meaningful client address.  I added
  a comment to this effect.  Maybe it works on other Unix versions.

- The __all__ variable was missing ThreadingMixIn and ForkingMixIn.

- Bumped __version__ to "0.4".

- Added a note about the test suite (to be checked in shortly).
2001-07-10 11:50:09 +00:00
Fredrik Lundh 2d96f11d07 map re.sub() to string.replace(), when possible 2001-07-08 13:26:57 +00:00
Fredrik Lundh e06cbb8c56 bug #436596
re.findall doesn't take a maxsplit argument
2001-07-06 20:56:10 +00:00
Fred Drake beb6713ea7 When reading a continuation line, make sure we still use the transformed
name when filling in the internal data structures, otherwise we incorrectly
raise a KeyError.

This fixes SF bug #432369.
2001-07-06 17:22:48 +00:00
Fred Drake dc19163b18 Allow underscores in tag names and quote characters in unquoted attribute
values.  The change for attribute values matches the way Mozilla and
Navigator view the world, at least.

This closes SF bug #436621.
2001-07-05 18:21:57 +00:00
Guido van Rossum c09cf33658 Rip out tests for xrange() features no longer supported. 2001-07-05 14:49:21 +00:00
unknown 31569561fd Added a non-recursive implementation of conjoin(), and a Knight's Tour
solver.  In conjunction, they easily found a tour of a 200x200 board:
that's 200**2 == 40,000 levels of backtracking.  Explicitly resumable
generators allow that to be coded as easily as a recursive solver (easier,
actually, because different levels can use level-customized algorithms
without pain), but without blowing the stack.  Indeed, I've never written
an exhaustive Tour solver in any language before that can handle boards so
large ("exhaustive" == guaranteed to find a solution if one exists, as
opposed to probabilistic heuristic approaches; of course, the age of the
universe may be a blip in the time needed!).
2001-07-04 22:11:22 +00:00
unknown a5aa0b5261 dummy checkin for testing, please ignore 2001-07-04 16:52:02 +00:00
unknown fee75ac4e5 Fix for SF bug #425868.
We should not depend on two spaces between words, so use the white
space after the to-be-encoded word only as lookahead and don't
actually consume it in the regular expression.
2001-07-04 10:15:58 +00:00
unknown 67bbd7a773 Clean up a bare except: clause. 2001-07-04 07:07:33 +00:00
unknown 3db163aa19 Clean up a bare except: clause. 2001-07-04 07:01:29 +00:00
Fred Drake fbe7b4fc8c Make the implementations of getElementsByTagName() and
getElementsByTagNameNS() consistent in form as well as functionality
(cosmetic).
2001-07-04 06:25:53 +00:00
Fred Drake ec3dfdee6a Only write out one blank line before the request data.
This closes SF patch #419459.
2001-07-04 05:18:29 +00:00
Fredrik Lundh df781e6a3f reapplied darryl gallion's minimizing repeat fix. I'm still not 100%
sure about this one, but test #133283 now works even with the fix in
place, and so does the test suite.  we'll see what comes up...
2001-07-02 19:54:28 +00:00
Fredrik Lundh 19af43d78a added martin's BIGCHARSET patch to SRE 2.1.1. martin reports 2x
speedups for certain unicode character ranges.
2001-07-02 16:58:38 +00:00
Fred Drake 1fb5ce0323 Avoid using os.path.normcase() on sys.path elements; doing so causes paths
to be presented in an unfamiliar case on case-preserving filesystems.

This closes SF patch #436173.
2001-07-02 16:55:42 +00:00
Tim Peters 683ecc7374 Nuke hard tabs. 2001-07-02 04:59:35 +00:00
Tim Peters d1c296537f Whitespace normalization; the plat-riscos file didn't even get by
tabnanny.py.
2001-07-02 04:57:30 +00:00
Tim Peters 353026663c A clever union-find implementation from c.l.py, due to David Eppstein.
This is another one that leaks memory without an explict clear!  Time to
bite this bullet.
2001-07-02 01:38:33 +00:00
Tim Peters c468fd28b6 Derive an industrial-strength conjoin() via cross-recursion loop unrolling,
and fiddle the conjoin tests to exercise all the new possible paths.
2001-06-30 07:29:44 +00:00
Tim Peters 4efb6e9643 Turns out Neil didn't intend for *all* of his gen-branch work to get
committed.

tokenize.py:  I like these changes, and have tested them extensively
without even realizing it, so I just updated the docstring and the docs.

tabnanny.py:  Also liked this, but did a little code fiddling.  I should
really rewrite this to *exploit* generators, but that's near the bottom
of my effort/benefit scale so doubt I'll get to it anytime soon (it
would be most useful as a non-trivial example of ideal use of generators;
but test_generators.py has already grown plenty of food-for-thought
examples).

inspect.py:  I'm sure Ping intended for this to continue running even
under 1.5.2, so I reverted this to the last pre-gen-branch version.  The
"bugfix" I checked in in-between was actually repairing a bug *introduced*
by the conversion to generators, so it's OK that the reverted version
doesn't reflect that checkin.
2001-06-29 23:51:08 +00:00
Guido van Rossum 52b8c29ca7 Solve SF bug #231249: cgi.py opens too many (temporary) files.
class FieldStorage: this patch changes read_lines() and co. to use a
StringIO() instead of a real file.  The write() calls are redirected
to a private method that replaces it with a real, external file only
when it gets too big (> 1000 bytes).

This avoids problems in forms using the multipart/form-data encoding
with many fields.  The original code created a temporary file for
*every* field (not just for file upload fields), thereby sometimes
exceeding the open file limit of some systems.

Note that the simpler solution "use a real file only for file uploads"
can't be used because the form field parser has no way to tell which
fields correspond to file uploads.

It's *possible* but extremely unlikely that this would break someone's
code; they would have to be stepping way outside the documented
interface for FieldStorage and use f.file.fileno(), or depend on
overriding make_file() to return a file-like object with additional
known properties.
2001-06-29 13:06:06 +00:00
Tim Peters be4f0a7748 Added a simple but general backtracking generator (conjoin), and a couple
examples of use.  These poke stuff not specifically targeted before, incl.
recursive local generators relying on nested scopes, ditto but also
inside class methods and rebinding instance vars, and anonymous
partially-evaluated generators (the N-Queens solver creates a different
column-generator for each row -- AFAIK this is my invention, and it's
really pretty <wink>).  No problems, not even a new leak.
2001-06-29 02:41:16 +00:00
Tim Peters 08a898f85d Another "if 0:" hack, this time to complain about otherwise invisible
"return expr" instances in generators (which latter may be generators
due to otherwise invisible "yield" stmts hiding in "if 0" blocks).
This was fun the first time, but this has gotten truly ugly now.
2001-06-28 01:52:22 +00:00
Tim Peters f6ed0740a8 This no longer leaks memory when run in an infinite loop. However,
that required explicitly calling LazyList.clear() in the two tests that
use LazyList (I added a LazyList Fibonacci generator too).

A real bitch:  the extremely inefficient first version of the 2-3-5 test
*looked* like a slow leak on Win98SE, but it wasn't "really":  it generated
so many results that the heap grew over 4Mb (tons of frames!  the number
of frames grows exponentially in that test).  Then Win98SE malloc() starts
fragmenting address space allocating more and more heaps, and the visible
memory use grew very slowly while the disk was thrashing like mad.
Printing fewer results (i.e., keeping the heap burden under 4Mb) made
that illusion vanish.

Looks like there's no hope for plugging the LazyList leaks automatically
short of adding frameobjects and genobjects to gc.  OTOH, they're very
easy to break by hand, and they're the only *kind* of plausibly realistic
leaks I've been able to provoke.

Dilemma.
2001-06-27 07:17:57 +00:00
Martin v. Löwis ce9b5a55e1 Encode surrogates in UTF-8 even for a wide Py_UNICODE.
Implement sys.maxunicode.
Explicitly wrap around upper/lower computations for wide Py_UNICODE.
When decoding large characters with UTF-8, represent expected test
results using the \U notation.
2001-06-27 06:28:56 +00:00
Tim Peters e77f2e2798 gen_getattr: make the gi_running and gi_frame members discoverable (but
not writable -- too dangerous!) from Python code.
2001-06-26 22:24:51 +00:00
Barry Warsaw 41775385df Add a bunch of tests for extended dict.update() where the argument is
a non-dictionary mapping object.  Include tests for several expected
failure modes.
2001-06-26 20:09:28 +00:00
Tim Peters b6c3ceae79 SF bug #436207: "if 0: yield x" is ignored.
Not anymore <wink>.  Pure hack.  Doesn't fix any other "if 0:" glitches.
2001-06-26 03:36:28 +00:00
Tim Peters 3e7b1a04a0 Teach the types module about generators. Thanks to James Althoff on the
Iterators list for bringing it up!
2001-06-25 19:46:25 +00:00
Just van Rossum ae1f65ff82 Return self.trace_dispatch from dispatch_return() to enable stepping through generators. (An alternative would be to create a new "yield" debugger event, but that involves many more changes, and might break Bdb subclasses.) 2001-06-25 18:01:24 +00:00
Steven M. Gava d7b6ed268e Initial revision 2001-06-25 07:23:57 +00:00
Tim Peters 2106ef0222 Repair indentation in comment.
Add a temporary driver to help track down remaining leak(s).
2001-06-25 01:30:12 +00:00
Tim Peters fee69d0313 Changed some comments. Removed the caution about clearing globs, since
clearing a shallow copy _run_examples() makes itself can't hurt anything.
2001-06-24 20:24:16 +00:00
Tim Peters d4ad59e1eb Clear the copy of the globs dict after running examples. This helps to
break cycles, which are a special problem when running generator tests
that provoke exceptions by invoking the .next() method of a named
generator-iterator:  then the iterator is named in globs, and the
iterator's frame gets a tracekback object pointing back to globs, and
gc doesn't chase these types so the cycle leaks.

Also changed _run_examples() to make a copy of globs itself, so its
callers (direct and indirect) don't have to (and changed the callers
to stop making their own copies); *that* much is a change I've been
meaning to make for a long time (it's more robust the new way).

Here's a way to provoke the symptom without doctest; it leaks at a
prodigious rate; if the last two "source" lines are replaced with
    g().next()
the iterator isn't named and then there's no leak:

source = """\
def g():
    yield 1/0

k = g()
k.next()
"""

code = compile(source, "<source>", "exec")

def f(globs):
    try:
        exec code in globs
    except ZeroDivisionError:
        pass

while 1:
    f(globals().copy())

After this change, running test_generators in an infinite loop still leaks,
but reduced from a flood to a trickle.
2001-06-24 20:02:47 +00:00
Tim Peters 77f2d504c3 doctest systematically leaked memory when handling an exception in an
example (an obvious trackback cycle).  Repaired.
Bugfix candidate.
2001-06-24 18:59:01 +00:00
Tim Peters b2bc6a93df Added a "generate k-combinations of a list" example posted to c.l.py. 2001-06-24 10:14:27 +00:00
Tim Peters ea2e97a08a New tests to provoke SyntaxErrors unique to generators. Minor fiddling
of other tests.
2001-06-24 07:10:02 +00:00
Tim Peters 08bba953ea doctest doesn't handle intentional SyntaxError exceptions gracefully,
because it picks up the first line of traceback.format_exception_only()
instead of the last line.  Pick up the last line instead!
2001-06-24 06:46:58 +00:00
Tim Peters ee30927b45 Another variant of the 2-3-5 test, mixing generators with a LazyList class.
Good news:  Some of this stuff is pretty sophisticated (read nuts), and
I haven't bumped into a bug yet.
Bad news:  If I run the doctest in an infinite loop, memory is clearly
leaking.
2001-06-24 05:47:06 +00:00
Tim Peters b9e9ff1288 More tests. 2001-06-24 03:44:52 +00:00
Tim Peters 0f9da0acde Add a recursive Sieve of Eratosthenes prime generator. Not practical,
but it's a heck of a good generator exerciser (think about it <wink>).
2001-06-23 21:01:47 +00:00
Tim Peters 6ba5f79674 Add all the examples from PEP 255, and a few email examples. 2001-06-23 20:45:43 +00:00
Tim Peters 1def351b45 New std test for generators, initially populated with doctests NeilS put
together.
2001-06-23 20:27:04 +00:00
Fred Drake a2d848e99c Add sha and _sre to the list of allowed built-in modules. 2001-06-22 18:19:16 +00:00
Tim Peters d6d010b874 Teach the UNPACK_SEQUENCE opcode how to tease an iterable object into
giving up the goods.
NEEDS DOC CHANGES
2001-06-21 02:49:55 +00:00
Barry Warsaw 7599a3fc5a Add a bunch of sample strings to test soft line breaks of varying end
cases.
2001-06-19 22:48:42 +00:00
Barry Warsaw dac67ac8bf encode(): Fixed the handling of soft line breaks for lines over 76
characters in length.  Remember that when calculating the soft breaks,
the trailing `=' sign counts against the max length!
2001-06-19 22:48:10 +00:00
Jack Jansen 9020bcebc8 - _filename_to_abs() didn't cater for .. components in the pathname. Fixed.
- compile() didn't return a (empty) list of objects. Fixed.
- the various _fix_xxx_args() methods weren't called (are they new or did I overlook them?). Fixed.
2001-06-19 21:23:11 +00:00
Jack Jansen 97df7b61f2 The test used int(time.time()) to get a random number, but this doesn't work on the mac (where times are bigger than ints). Changed to int(time.time()%1000000). 2001-06-19 20:20:05 +00:00
Jack Jansen 1bdcadd610 An import MacOS was missing after the code-rearranging. Added. 2001-06-19 20:11:36 +00:00
Marc-André Lemburg a37171dd86 Test by Martin v. Loewis for the new UTF-16 codec handling of BOM
marks.
2001-06-19 20:09:28 +00:00
Marc-André Lemburg 92b550cdd8 This patch by Martin v. Loewis changes the UTF-16 codec to only
write a BOM at the start of the stream and also to only read it as
BOM at the start of a stream.

Subsequent reading/writing of BOMs will read/write the BOM as ZWNBSP
character. This is in sync with the Unicode specifications.

Note that UTF-16 files will now *have* to start with a BOM mark
in order to be readable by the codec.
2001-06-19 20:07:51 +00:00
Just van Rossum 92c5bdbc19 Fixed -D emulation for symbols with a value, as specified with the define_macros Extension argument. 2001-06-19 19:44:02 +00:00
Barry Warsaw 7069763913 A unittest-based test for the quopri module. 2001-06-19 19:08:13 +00:00
Barry Warsaw 9b630a5020 Better support for RFC 1521 quoted-printable specification, along with
addition of interface for consistency with base64 module.  Namely,

encodestring(), decodestring(): New functions which accept a string
object and return a string object.  They just wrap the string in
StringIOs and pass them to the encode() and decode() methods
respectively.  encodestring() accepts a default argument of quotetabs,
defaulting to zero, which is passed on straight through to encode().

encode(): Fix the bug where an extra newline would always be added to
the output, which prevented an idempotent roundtrip through
encode->decode.  Now, if the source string doesn't end in a newline,
then the result string won't end in a newline.

Also, extend the quotetabs argument semantics to include quoting
embedded strings, which is also optional according to the RFC.

test() -> main()

"from quopri import *" also imports encodestring() and decodestring().
2001-06-19 19:07:46 +00:00
Tim Peters 463766816c Updated keyword.py for "yield". 2001-06-19 00:26:25 +00:00
Tim Peters ff0a2bb523 Somebody checked this in w/ an ambiguous tab/space mix (reported by
Mark Favas).
2001-06-18 23:56:36 +00:00
Tim Peters 3eec38af37 Added "i" and "l" to the list of std-mode struct codes that don't range-
check correctly on pack().  While these were checking OK on my 32-bit box,
Mark Favas reported failures on a 64-bit box (alas, easy to believe).
2001-06-18 22:27:39 +00:00
Tim Peters 5ca576ed0a Merging the gen-branch into the main line, at Guido's direction. Yay!
Bugfix candidate in inspect.py:  it was referencing "self" outside of
a method.
2001-06-18 22:08:13 +00:00
Tim Peters 1dad6a86de SF bug 434186: 0x80000000/2 != 0x80000000>>1
i_divmod:  New and simpler algorithm.  Old one returned gibberish on most
boxes when the numerator was -sys.maxint-1.  Oddly enough, it worked in the
release (not debug) build on Windows, because the compiler optimized away
some tricky sign manipulations that were incorrect in this case.
Makes you wonder <wink> ...
Bugfix candidate.
2001-06-18 19:21:11 +00:00
Guido van Rossum 183a2f2437 Fix SF bug #433904 (Alex Martelli) - all s_* methods return None only. 2001-06-18 12:33:36 +00:00
Martin v. Löwis f3b30747d6 Patch #413171: Implement get, setdefault, update in terms of
has_key, __getitem__, and __setitem__.
2001-06-18 01:09:41 +00:00
Guido van Rossum a85e2c8557 SF patch #433619, by Michel Pelletier:
Summary: NAMESPACE support in imaplib.py

Initial Comment:
Support for the IMAP NAMESPACE extension defined in rfc
2342.  This is almost a necessity for working with
modern IMAP servers.
2001-06-17 13:31:25 +00:00
Martin v. Löwis fb73bb129b Synchronize with 1.13 of PyXML:
Allow application to set a new content handler and lex_prop handler during
parsing. Closes bug #433761.
Small hack to make expat be ignored in Jython.
2001-06-17 07:05:43 +00:00
Tim Peters 17e17d4406 Generalize the new qQ std-mode tests to all int codes (bBhHiIlLqQ).
Unfortunately, the std-mode bBhHIL codes don't do any range-checking; if
and when some of those get fixed, remove their letters from the
IntTester.BUGGY_RANGE_CHECK string.  In the meantime, a msg saying that
range-tests are getting skipped is printed to stdout whenever one is
skipped.
2001-06-13 22:45:27 +00:00
Tim Peters da9c5b35a3 The new {b,l}p_{u,}longlong() didn't check get_pylong()'s return for NULL.
Repaired that, and added appropriate tests for it to test_struct.py.
2001-06-13 01:26:35 +00:00
Guido van Rossum 83213cc0a0 Add new built-in 'help' which invokes pydoc.help (with a twist). 2001-06-12 16:48:52 +00:00
Tim Peters 7a3bfc3a47 Added q/Q standard (x-platform 8-byte ints) mode in struct module.
This completes the q/Q project.

longobject.c _PyLong_AsByteArray:  The original code had a gross bug:
the most-significant Python digit doesn't necessarily have SHIFT
significant bits, and you really need to count how many copies of the sign
bit it has else spurious overflow errors result.

test_struct.py:  This now does exhaustive std q/Q testing at, and on both
sides of, all relevant power-of-2 boundaries, both positive and negative.

NEWS:  Added brief dict news while I was at it.
2001-06-12 01:22:22 +00:00
Tim Peters c533edceb1 Renamed some stuff to tell the truth about what it does. 2001-06-10 23:52:59 +00:00
Tim Peters 7b9542a3f7 Initial support for 'q' and 'Q' struct format codes: for now, only in
native mode, and only when config #defines HAVE_LONG_LONG.  Standard mode
will eventually treat them as 8-byte ints across all platforms, but that
likely requires a new set of routines in longobject.c first (while
sizeof(long) >= 4 is guaranteed by C, there's nothing in C we can rely
on x-platform to hold 8 bytes of int, so we'll have to roll our own;
I'm thinking of a simple pair of conversion functions, Python long
to/from sized vector of unsigned bytes; that may be useful for GMP
conversions too; std q/Q would call them with size fixed at 8).

test_struct.py:  In addition to adding some native-mode 'q' and 'Q' tests,
got rid of unused code, and repaired a non-portable assumption about
native sizeof(short) (it isn't 2 on some Cray boxes).

libstruct.tex:  In addition to adding a bit of 'q'/'Q' docs (more needed
later), removed an erroneous footnote about 'I' behavior.
2001-06-10 23:40:19 +00:00
Tim Peters 0bb580d297 SF bug 431772: traceback.print_exc() causes traceback
Patch from Michael Hundson.
format_exception_only() blew up when trying to report a SyntaxError
from a string input (line is None in this case, but it assumed a string).
Bugfix candidate.
2001-06-10 18:58:26 +00:00
Tim Peters 2a7f384122 SF bug 430991: wrong co_lnotab
Armin Rigo pointed out that the way the line-# table got built didn't work
for lines generating more than 255 bytes of bytecode.  Fixed as he
suggested, plus corresponding changes to pyassem.py, plus added some
long overdue docs about this subtle table to compile.c.

Bugfix candidate (line numbers may be off in tracebacks under -O).
2001-06-09 09:26:21 +00:00
Martin v. Löwis 0163d6d6ef Patch #424475: Speed-up tp_compare usage, by special-casing the common
case of objects with equal types which support tp_compare. Give
type objects a tp_compare function.
Also add c<0 tests before a few PyErr_Occurred tests.
2001-06-09 07:34:05 +00:00
Fred Drake edb5ffb2c1 Performance improvements to the profiler:
Ensure that all the default timers are called as functions, not an
expensive method wrapper around a variety of different functions.

Agressively avoid dictionary lookups.

Modify the dispatch scheme (Profile.trace_dispatch_*(), where * is not
'call', 'exception' or 'return') so that the callables dispatched to
are simple functions and not bound methods -- this reduces the number
of layers of Python call machinery that gets touched.

Remove a couple of duplicate imports from the "if __name__ == ..."
section.

This closes SF patch #430948.
2001-06-08 04:25:24 +00:00
Martin v. Löwis 13b8bc5478 Patch #429957: Add support for cp1140, which is identical to cp037,
with the addition of the euro character.
Also added a few EDBDIC aliases.
2001-06-07 19:39:25 +00:00
Peter Schneider-Kamp fbb2b4c4a5 check in for patch #430846
use faster code for base64.encodestring (courtesy of Mr. Tim Peters)
and for base64.decodestring (courtesy of Anthony Baxter)
2001-06-07 18:56:13 +00:00
Martin v. Löwis 2c07195574 Previous check-in was by mistake, undo it. 2001-06-07 05:52:17 +00:00
Martin v. Löwis 22adac50cb Patch #416220: Fix misplaced paren. 2001-06-07 05:49:05 +00:00
Martin v. Löwis b5d4d2a7d5 Patch #409973: Speedup glob.glob, add fnmatch.filter. 2001-06-06 06:24:38 +00:00
Martin v. Löwis e24fef0dd2 Fix bug #422702: Make flag argument to open optional, and document it that way. 2001-06-05 05:33:19 +00:00
Martin v. Löwis 2750bcc2d1 Add .pyo as an extension, fixes bug #416462. Also restore alphabetic order. 2001-06-05 05:17:00 +00:00
Fred Drake 58422e5820 Convert the parser module test to use PyUnit. 2001-06-04 03:56:24 +00:00
Mark Hammond 194bfb2805 Add some useful Windows encodings - patch #423221. 2001-06-04 02:31:23 +00:00
Martin v. Löwis 351c3d0554 Implement testGetElementsByTagNameNS. 2001-06-03 14:27:02 +00:00
Martin v. Löwis ed525fb0df Fix getElementsByTagNameNS:
- actually return a result
  - Compare with tag.localName in getElementsByTagNameNSHelper
2001-06-03 14:06:42 +00:00
Tim Peters 453163d842 lookdict: stop more insane core-dump mutating comparison cases. Should
be possible to provoke unbounded recursion now, but leaving that to someone
else to provoke and repair.
Bugfix candidate -- although this is getting harder to backstitch, and the
cases it's protecting against are mondo contrived.
2001-06-03 04:54:32 +00:00
Tim Peters fa517b277f Fix comment. 2001-06-02 08:18:58 +00:00
Tim Peters 23cf6be23c Coredumpers from Michael Hudson, mutating dicts while printing or
converting to string.
Critical bugfix candidate -- if you take this seriously <wink>.
2001-06-02 08:02:56 +00:00
Skip Montanaro 951a8841d1 more public symbols for __all__ 2001-06-01 16:25:38 +00:00
Tim Peters 0b76d3a8d1 This division test was too stringent in its accuracy expectations for
random inputs:  if you ran the test 100 times, you could expect it to
report a bogus failure.  So loosened its expectations.
Also changed the way failing tests are printed, so that when run under
regrtest.py we get enough info to reproduce the failure.
2001-05-29 22:18:09 +00:00
Tim Peters 9a828d3c61 BadDictKey test: The output file expected "raising error" to be printed
exactly once.  But the test code can't know that, as the number of times
__cmp__ is called depends on internal details of the dict implementation.
This is especially nasty because the __hash__ method returns the address
of the class object, so the hash codes seen by the dict can vary across
runs, causing the dict to use a different probe order across runs.  I
just happened to see this test fail about 1 run in 7 today, but only
under a release build and when passing -O to Python.  So, changed the test
to be predictable across runs.
2001-05-29 21:14:32 +00:00
Fred Drake e51fe8d0a3 runtest(): When generating output, if the result is a single line with the
name of the test, only write the output file if it already exists (and
    tell the user to consider removing it).  This avoids the generation of
    unnecessary turds.
2001-05-29 17:10:51 +00:00
Fred Drake 4f1e495fa0 The one-line output files are no longer needed, so do not keep them. 2001-05-29 16:54:22 +00:00
Jeremy Hylton bea3947fb8 Variety of test cases for call to builtin functions 2001-05-29 16:26:20 +00:00
Tim Peters 3a2ab1ab69 Whitespace normalization. 2001-05-29 06:06:54 +00:00
Tim Peters 12f21ae07f Patch from Gordon McMillan.
updatecache():  When using imputil, sys.path may contain things other than
strings.  Ignore such things instead of blowing up.
Hard to say whether this is a bugfix or a feature ...
2001-05-29 04:27:01 +00:00
Tim Peters 0c6010be75 Jack Jansen hit a bug in the new dict code, reported on python-dev.
dictresize() was too aggressive about never ever resizing small dicts.
If a small dict is entirely full, it needs to rebuild it despite that
it won't actually resize it, in order to purge old dummy entries thus
creating at least one virgin slot (lookdict assumes at least one such
exists).

Also took the opportunity to add some high-level comments to dictresize.
2001-05-23 23:33:57 +00:00
Guido van Rossum 54a069f271 When Tim untabified this file, his editor accidentally assumed 4-space
tabs.  The title was centered using 8-byte tabs, however, and the
result looked strange.  Fixed this.
2001-05-23 13:24:30 +00:00
Tim Peters f5f6c436c6 Remove test_doctest's expected-output file.
Change test_doctest and test_difflib to pass regrtest's notion of
verbosity on to doctest.
Add explanation for a dozen "new" things to test/README.
2001-05-23 07:46:36 +00:00
Fred Drake a6daad2e55 Update to reflect recent changes to regrtest and the new approaches to
testing using doctest and PyUnit.
2001-05-23 04:57:49 +00:00
Fred Drake 1c48eb74c9 Merge my changes to the offending comment with Guido's changes. 2001-05-23 04:53:44 +00:00
Tim Peters dec4a6143c Remove test_difflib's output file and change test_difflib to stop
generating it.  Since this is purely a doctest, the output file never
served a good purpose.
2001-05-23 01:45:19 +00:00
Guido van Rossum 07f353c560 Removed incorrect comment left over from sgmllib.py. 2001-05-22 23:39:10 +00:00
Fred Drake b8e76a7b3d Remove output files that are no longer needed since the corresponding
tests were moved to PyUnit.
2001-05-22 22:32:24 +00:00
Fred Drake cf99225312 Move the sha tests to PyUnit. 2001-05-22 21:43:17 +00:00
Fred Drake 275dfda633 Convert binhex regression test to PyUnit. We could use a better test
for this.
2001-05-22 21:01:14 +00:00
Fred Drake 5379d05dc3 Convert copy_reg test to PyUnit. 2001-05-22 20:38:44 +00:00
Fred Drake 970a53cb3e Remove unused import. 2001-05-22 20:25:05 +00:00
Fred Drake babd7378a3 Simple conversion to PyUnit -- this test really needs more work! 2001-05-22 20:22:06 +00:00
Fred Drake 64fe52351a Convert dospath test suite to PyUnit, adding a couple more cases for
isabs() (no false results were checked) and splitdrive().
2001-05-22 20:20:49 +00:00
Fred Drake 876dc70b2e Re-write the rfc822 tests to use PyUnit.
Update to reflect using "" as the default value for the second parameter
to the get() method.
2001-05-22 19:38:31 +00:00
Fred Drake 233226e977 Per discussion with Barry, make the default value for both get() and
setdefault() the empty string.  In setdefault(), use + to join the value
to create the entry for the headers attribute so that TypeError is raised
if the value is of the wrong type.
2001-05-22 19:36:50 +00:00
Tim Peters d97422115e Implementing an idea from Guido on the checkins list:
When regrtest.py finds an attribute "test_main" in a test it imports,
regrtest runs the test's test_main after the import.  test_threaded_import
needs this else the cross-thread import lock prevents it from making
progress.  Other tests can use this hack too, but I doubt it will ever be
popular.
2001-05-22 18:28:25 +00:00
Fred Drake bc5619826e Convert time module tests to PyUnit. 2001-05-22 17:02:02 +00:00
Fred Drake d992c2c74d Migrate the strop test to PyUnit. 2001-05-22 16:44:33 +00:00
Tim Peters 6626c1f183 create_message(): When os.link() doesn't exist, make a copy of the msg
instead.  Allows this test to finish on Windows again.
2001-05-22 16:29:01 +00:00
Barry Warsaw 1d099103d8 Application of patch #401842 by Denis S. Otkidach to support
localization of month and day names.
2001-05-22 15:58:30 +00:00
Fred Drake cf71fefa59 Add tests for the new .get() and .setdefault() methods of rfc822.Message
objects.
2001-05-22 15:02:19 +00:00
Fred Drake 0295929280 Added .get() and .setdefault() support to rfc822.Message. 2001-05-22 14:58:10 +00:00
Tim Peters aa222234c0 New test adapted from the ancient Demo/threads/bug.py.
ICK ALERT:  read the long comment block before run_the_test().  It was
almost impossible to get this to run without instant deadlock, and the
solution here sucks on several counts.  If you can dream up a better way,
let me know!
2001-05-22 09:34:27 +00:00
Fred Drake febbe33a49 Remove all files of expected output that contain only the name of the
test; there is no need to store this in a file if the actual test code
does not produce any output.
2001-05-21 21:12:10 +00:00
Fred Drake ae1bb176be If the file containing expected output does not exist, assume that it
contains a single line of text giving the name of the output file.  This
covers all tests that do not actually produce any output in the test code.
2001-05-21 21:08:12 +00:00
Andrew M. Kuchling 0152fbdc7f Fix bug #418369: typo in bdist_rpm 2001-05-21 20:34:38 +00:00
Fred Drake c02bc3e819 Re-write the mailbox test suite to use PyUnit. Cover a lot more ground
for the Maildir mailbox format.  This still does not address other mailbox
formats.
2001-05-21 20:23:21 +00:00
Guido van Rossum 39d345127e parse_declaration(): be more lenient in what we accept. We now
basically accept <!...> where the dots can be single- or double-quoted
strings or any other character except >.

Background: I found a real-life example that failed to parse with
the old assumption: http://www.opensource.org/licenses/jabberpl.html
contains a few constructs of the form <![if !supportLists]>...<![endif]>.
2001-05-21 20:17:17 +00:00
Fred Drake acb117eb11 Update a comment. 2001-05-18 21:50:02 +00:00
Fred Drake 97656a1c82 Simple conversion to PyUnit. 2001-05-18 21:45:35 +00:00
Fred Drake 5b811bee5d Simple conversion to PyUnit. 2001-05-18 21:38:52 +00:00
Fred Drake bd3090d4d6 Added test suite for the new HTMLParser module, originally from the
TAL/PageTemplate package for Zope.  This only needed a little boilerplate
change; the tests themselves are unchanged.
2001-05-18 15:32:59 +00:00
Guido van Rossum 8846d7178b A much improved HTML parser -- a replacement for sgmllib. The API is
derived from but not quite compatible with that of sgmllib, so it's a
new file.  I suppose it needs documentation, and htmllib needs to be
changed to use this instead of sgmllib, and sgmllib needs to be
declared obsolete.  But that can all be done later.

This code was first published as part of TAL (part of Zope Page
Templates), but that was strongly based on sgmllib anyway.  Authors
are Fred drake and Guido van Rossum.
2001-05-18 14:50:52 +00:00
Guido van Rossum 99f9baa331 Fixed botched indent in _init_mac() code. (It may never be executed,
but it still can't have any syntax errors.  Went a little too fast
there, Jack? :-)
2001-05-17 15:03:14 +00:00
Jack Jansen dd13a20490 Made distutils understand the MacPython Carbon runtime model. Distutils will build for the runtime model you are currently using for the interpreter. 2001-05-17 12:52:01 +00:00
Marc-André Lemburg 716cf91839 Moved the encoding map building logic from the individual mapping
codec files to codecs.py and added logic so that multi mappings
in the decoding maps now result in mappings to None (undefined mapping)
in the encoding maps.
2001-05-16 09:41:45 +00:00
Tim Peters 30324a7363 Just changed "x,y" to "x, y" everywhere (i.e., inserted horizontal space
after commas that didn't have any).
2001-05-15 17:19:16 +00:00
Guido van Rossum acfdf156aa Add quoted-printable codec 2001-05-15 15:34:07 +00:00
Fred Drake da05e977f3 abspath(): Fix inconsistent indentation. 2001-05-15 15:23:01 +00:00
Marc-André Lemburg 2d9204199f This patch changes the way the string .encode() method works slightly
and introduces a new method .decode().

The major change is that strg.encode() will no longer try to convert
Unicode returns from the codec into a string, but instead pass along
the Unicode object as-is. The same is now true for all other codec
return types. The underlying C APIs were changed accordingly.

Note that even though this does have the potential of breaking
existing code, the chances are low since conversion from Unicode
previously took place using the default encoding which is normally
set to ASCII rendering this auto-conversion mechanism useless for
most Unicode encodings.

The good news is that you can now use .encode() and .decode() with
much greater ease and that the door was opened for better accessibility
of the builtin codecs.

As demonstration of the new feature, the patch includes a few new
codecs which allow string to string encoding and decoding (rot13,
hex, zip, uu, base64).

Written by Marc-Andre Lemburg. Copyright assigned to the PSF.
2001-05-15 12:00:02 +00:00
Guido van Rossum 2e0a654f6e Add warnings to the strop module, for to those functions that really
*are* obsolete; three variables and the maketrans() function are not
(yet) obsolete.

Add a compensating warnings.filterwarnings() call to test_strop.py.

Add this to the NEWS.
2001-05-15 02:14:44 +00:00
Fred Drake 992d387540 Convert a couple of comments to docstrings -- PyUnit can use these when
the regression test is run in verbose mode.
2001-05-14 19:15:23 +00:00
Tim Peters 95b3f78622 pprint's workhorse _safe_repr() function took time quadratic in the # of
elements when crunching a list, dict or tuple.  Now takes linear time
instead -- huge speedup for even moderately large containers, and the
code is notably simpler too.
Added some basic "is the output correct?" tests to test_pprint.
2001-05-14 18:39:41 +00:00
Fred Drake 43913dd27c Convert the pprint test to use PyUnit. 2001-05-14 17:41:20 +00:00
Tim Peters a814db579d SF bug[ #423781: pprint.isrecursive() broken. 2001-05-14 07:05:58 +00:00
Tim Peters a0599575aa A disgusting "fix" for the test___all__ failure under Windows. 2001-05-13 09:01:06 +00:00
Mark Hammond ef8b654bbe Add support for Windows using "mbcs" as the default Unicode encoding when dealing with the file system. As discussed on python-dev and in patch 410465. 2001-05-13 08:04:26 +00:00
Tim Peters 2f228e75e4 Get rid of the superstitious "~" in dict hashing's "i = (~hash) & mask".
The comment following used to say:
	/* We use ~hash instead of hash, as degenerate hash functions, such
	   as for ints <sigh>, can have lots of leading zeros. It's not
	   really a performance risk, but better safe than sorry.
	   12-Dec-00 tim:  so ~hash produces lots of leading ones instead --
	   what's the gain? */
That is, there was never a good reason for doing it.  And to the contrary,
as explained on Python-Dev last December, it tended to make the *sum*
(i + incr) & mask (which is the first table index examined in case of
collison) the same "too often" across distinct hashes.

Changing to the simpler "i = hash & mask" reduced the number of string-dict
collisions (== # number of times we go around the lookup for-loop) from about
6 million to 5 million during a full run of the test suite (these are
approximate because the test suite does some random stuff from run to run).
The number of collisions in non-string dicts also decreased, but not as
dramatically.

Note that this may, for a given dict, change the order (wrt previous
releases) of entries exposed by .keys(), .values() and .items().  A number
of std tests suffered bogus failures as a result.  For dicts keyed by
small ints, or (less so) by characters, the order is much more likely to be
in increasing order of key now; e.g.,

>>> d = {}
>>> for i in range(10):
...    d[i] = i
...
>>> d
{0: 0, 1: 1, 2: 2, 3: 3, 4: 4, 5: 5, 6: 6, 7: 7, 8: 8, 9: 9}
>>>

Unfortunately. people may latch on to that in small examples and draw a
bogus conclusion.

test_support.py
    Moved test_extcall's sortdict() into test_support, made it stronger,
    and imported sortdict into other std tests that needed it.
test_unicode.py
    Excluced cp875 from the "roundtrip over range(128)" test, because
    cp875 doesn't have a well-defined inverse for unicode("?", "cp875").
    See Python-Dev for excruciating details.
Cookie.py
    Chaged various output functions to sort dicts before building
    strings from them.
test_extcall
    Fiddled the expected-result file.  This remains sensitive to native
    dict ordering, because, e.g., if there are multiple errors in a
    keyword-arg dict (and test_extcall sets up many cases like that), the
    specific error Python complains about first depends on native dict
    ordering.
2001-05-13 00:19:31 +00:00
Fred Drake 7e473800c3 Fix one bare except: clause. 2001-05-11 19:52:57 +00:00
Fred Drake 6f6a14f888 Remove a bare try/except completely -- it just did not make sense!
Add a comment elsewhere making clear an assumption in the code.
2001-05-11 19:25:08 +00:00
Fred Drake e8187615e2 When guarding an import, only catch ImportError. 2001-05-11 19:21:41 +00:00
Fred Drake 31e18291c5 Clean up a bare except where we only expect to catch pcre.error. 2001-05-11 19:20:17 +00:00
Fred Drake 652553192e Clean up bare except where only IOError makes sense. 2001-05-11 19:15:28 +00:00
Fred Drake 553f68114f Clean up bare except: when determining whether a file is seekable. 2001-05-11 19:14:51 +00:00
Fred Drake 776d39e2c7 Opening a file for reading can raise IOError, so only catch that. 2001-05-11 18:47:54 +00:00
Fred Drake 1b7e079528 int() of a string is only expected to through ValueError, so do not use
a bare except clause.
2001-05-11 18:45:52 +00:00
Fred Drake 9f9b593f8d <socket>.getsockopt() and <socket>.setsockopt() can only raise socket.error,
so only catch that specific exception.
2001-05-11 18:28:54 +00:00
Fred Drake c79f3d0d42 Catch only the relevant exceptions instead of using a bare except clause. 2001-05-11 18:27:00 +00:00
Fred Drake 6278799f8e unlink() would normally be found in the "os" module, so use it from there.
Remove unused import of "sys".

If the file TESTFN exists before we start, try to remove it.

Add spaces around the = in some assignments.
2001-05-11 14:29:21 +00:00
Tim Peters 4c02fecf9c Make test_mutants stronger by also adding random keys during comparisons.
A Mystery:  test_mutants ran amazingly slowly even before dictobject.c
"got fixed".  I don't have a clue as to why.  dict comparison was and
remains linear-time in the size of the dicts, and test_mutants only tries
100 dict pairs, of size averaging just 50.  So "it should" run in less than
an eyeblink; but it takes at least a second on this 800MHz box.
2001-05-10 20:18:30 +00:00
Tim Peters fd69208b78 Change test_mmap.py to use test_support.TESTFN instead of hardcoded "foo",
and wrap the body in try/finally to ensure TESTFN gets cleaned up no
matter what.
2001-05-10 20:03:04 +00:00
Tim Peters 8c3e91efaf Repair typos in comments. 2001-05-10 19:40:30 +00:00
Fred Drake e61967f537 Change some text just a little to avoid font-lock hell. 2001-05-10 18:41:02 +00:00
Fred Drake aaa48ff5c9 Extend the weakref test suite to cover the complete mapping interface for
both weakref.Weak*Dictionary classes.

This closes SF bug #416480.
2001-05-10 17:16:38 +00:00
Fred Drake 48a1638d78 Do no regenerate modules that should no longer be here. 2001-05-10 15:52:47 +00:00
Fred Drake a94414a287 Remove all remaining uses of the FCNTL module from the standard library. 2001-05-10 15:33:31 +00:00
Tim Peters 95bf9390a4 SF bug #422121 Insecurities in dict comparison.
Fixed a half dozen ways in which general dict comparison could crash
Python (even cause Win98SE to reboot) in the presence of kay and/or
value comparison routines that mutate the dict during dict comparison.
Bugfix candidate.
2001-05-10 08:32:44 +00:00
Fred Drake 66aaaae54c Update to reflect deprecation of the FCNTL module: The fcntl module does
*not* define O_RDWR; get that from the os module.
2001-05-10 05:17:02 +00:00
Steve Purcell 4bc808533f patch 418489 from Andrew Dalke for string format bug 2001-05-10 01:28:40 +00:00
Tim Peters 1ee77d9b71 Guido has Spoken. Restore strop.replace()'s treatment of a 0 count as
meaning infinity -- but at least warn about it in the code!  I pissed
away a couple hours on this today, and don't wish the same on the next
in line.
Bugfix candidate.
2001-05-10 01:23:39 +00:00
Tim Peters da45d55a6e The strop module and test_strop.py believe replace() with a 0 count
means "replace everything".  But the string module, string.replace()
amd test_string.py believe a 0 count means "replace nothing".
"Nothing" wins, strop loses.
Bugfix candidate.
2001-05-10 00:59:45 +00:00
Tim Peters 1a7b3eee94 SF bug #422088: [OSF1 alpha] string.replace().
Platform blew up on "123".replace("123", "").  Michael Hudson pinned the
blame on platform malloc(0) returning NULL.
This is a candidate for all bugfix releases.
2001-05-09 23:00:26 +00:00
Fred Drake 48871f2a6e Remove the old platform-specific FCNTL.py modules; these are no longer
needed now that fcntl exports the constants.
2001-05-09 21:15:06 +00:00
Fred Drake 76d6139961 Add a new FCNTL.py backward compatibility module that issues a deprecation
warning.  This is similar to the TERMIOS backward compatbility module.
2001-05-09 21:13:23 +00:00
Fred Drake bc7809b529 Update the tests for the fcntl module to check passing in file objects,
and using the constants defined there instead of FCNTL.
2001-05-09 21:11:59 +00:00
Jeremy Hylton e3e61049a5 Trivial tests of urllib2 for recent SF bug 2001-05-09 15:50:25 +00:00
Jeremy Hylton 78cae61ad4 Raise useful exception when called with URL for which request type
cannot be determined.

Pseudo-fix for SF bug #420724
2001-05-09 15:49:24 +00:00
Tim Peters 72f98e9b83 SF bug #422177: Results from .pyc differs from .py
Store floats and doubles to full precision in marshal.
Test that floats read from .pyc/.pyo closely match those read from .py.
Declare PyFloat_AsString() in floatobject header file.
Add new PyFloat_AsReprString() API function.
Document the functions declared in floatobject.h.
2001-05-08 15:19:57 +00:00
Tim Peters e63415ead8 SF patch #421922: Implement rich comparison for dicts.
d1 == d2 and d1 != d2 now work even if the keys and values in d1 and d2
don't support comparisons other than ==, and testing dicts for equality
is faster now (especially when inequality obtains).
2001-05-08 04:38:29 +00:00
Jeremy Hylton 4c889011db SF patch 419176 from MvL; fixed bug 418977
Two errors in dict_to_map() helper used by PyFrame_LocalsToFast().
2001-05-08 04:08:59 +00:00
Tim Peters 7ae2229afb This is a test showing SF bug 422177. It won't trigger until I check in
another change (to test_import.py, which simply imports the new file).  I'm
checking this piece in now, though, to make it easier to distribute a patch
for x-platform checking.
2001-05-08 03:58:01 +00:00
Tim Peters 8572b4fedf Generalize zip() to work with iterators.
NEEDS DOC CHANGES.
More AttributeErrors transmuted into TypeErrors, in test_b2.py, and,
again, this strikes me as a good thing.
This checkin completes the iterator generalization work that obviously
needed to be done.  Can anyone think of others that should be changed?
2001-05-06 01:05:02 +00:00
Tim Peters ef0c42d4e5 Get rid of silly 5am "del" stmts. 2001-05-05 21:36:52 +00:00
Tim Peters cb8d368b82 Reimplement PySequence_Contains() and instance_contains(), so they work
safely together and don't duplicate logic (the common logic was factored
out into new private API function _PySequence_IterContains()).
Visible change:
    some_complex_number  in  some_instance
no longer blows up if some_instance has __getitem__ but neither
__contains__ nor __iter__.  test_iter changed to ensure that remains true.
2001-05-05 21:05:01 +00:00
Tim Peters 75f8e35ef4 Generalize PySequence_Count() (operator.countOf) to work with iterators. 2001-05-05 11:33:43 +00:00
Tim Peters de9725f135 Make 'x in y' and 'x not in y' (PySequence_Contains) play nice w/ iterators.
NEEDS DOC CHANGES
A few more AttributeErrors turned into TypeErrors, but in test_contains
this time.
The full story for instance objects is pretty much unexplainable, because
instance_contains() tries its own flavor of iteration-based containment
testing first, and PySequence_Contains doesn't get a chance at it unless
instance_contains() blows up.  A consequence is that
    some_complex_number in some_instance
dies with a TypeError unless some_instance.__class__ defines __iter__ but
does not define __getitem__.
2001-05-05 10:06:17 +00:00
Tim Peters 2cfe368283 Make unicode.join() work nice with iterators. This also required a change
to string.join(), so that when the latter figures out in midstream that
it really needs unicode.join() instead, unicode.join() can actually get
all the sequence elements (i.e., there's no guarantee that the sequence
passed to string.join() can be iterated over *again* by unicode.join(),
so string.join() must not pass on the original sequence object anymore).
2001-05-05 05:36:48 +00:00
Tim Peters 6912d4ddf0 Generalize tuple() to work nicely with iterators.
NEEDS DOC CHANGES.
This one surprised me!  While I expected tuple() to be a no-brainer, turns
out it's actually dripping with consequences:
1. It will *allow* the popular PySequence_Fast() to work with any iterable
   object (code for that not yet checked in, but should be trivial).
2. It caused two std tests to fail.  This because some places used
   PyTuple_Sequence() (the C spelling of tuple()) as an indirect way to test
   whether something *is* a sequence.  But tuple() code only looked for the
   existence of sq->item to determine that, and e.g. an instance passed
   that test whether or not it supported the other operations tuple()
   needed (e.g., __len__).  So some things the tests *expected* to fail
   with an AttributeError now fail with a TypeError instead.  This looks
   like an improvement to me; e.g., test_coercion used to produce 559
   TypeErrors and 2 AttributeErrors, and now they're all TypeErrors.  The
   error details are more informative too, because the places calling this
   were *looking* for TypeErrors in order to replace the generic tuple()
   "not a sequence" msg with their own more specific text, and
   AttributeErrors snuck by that.
2001-05-05 03:56:37 +00:00
Tim Peters 15d81efb8a Generalize reduce() to work with iterators.
NEEDS DOC CHANGES.
2001-05-04 04:39:21 +00:00