Commit Graph

6726 Commits

Author SHA1 Message Date
Fred Drake 8e8dc419d0 Remove bogus assignment to self.length in NamedNodeMap.__delitem__(). 2002-07-02 17:27:06 +00:00
Martin v. Löwis adfa7409f8 Bump required PyXML version to 0.6.5. 2002-06-30 15:08:22 +00:00
Martin v. Löwis 7d650ca83b Implement the encoding argument for toxml and toprettyxml.
Document toprettyxml.
2002-06-30 15:05:00 +00:00
Martin v. Löwis 2ebfd09e58 Merge from PyXML:
[1.3] Added documentation of the namespace URI for elements with no namespace.
[1.4] New property http://www.python.org/sax/properties/encoding.
[1.5] Support optional string interning in pyexpat.
2002-06-30 07:38:50 +00:00
Martin v. Löwis 0e2d881406 Add xml namespace initially (PyXML 1.19). 2002-06-30 07:32:56 +00:00
Martin v. Löwis d1b516c274 Fix spacing. 2002-06-30 07:27:30 +00:00
Martin v. Löwis 18476a3740 Merge changes from PyXML:
[1.15]
Added understanding of the feature_validation, feature_external_pes,
and feature_string_interning features.
Added support for the feature_external_ges feature.
Added support for the property_xml_string property.
[1.16]
Made it recognize the namespace prefixes feature.
[1.17]
removed erroneous first line
[1.19]
Support optional string interning in pyexpat.
[1.21]
Restore compatibility with versions of Python that did not support weak
references.  These do not get the cyclic reference fix, but they will
continue to work as they did before.
[1.22]
Activate entity processing unless standalone.
2002-06-30 07:21:24 +00:00
Raymond Hettinger 46ac8eb3c8 Code modernization. Replace v=s[i]; del s[i] with single lookup v=s.pop(i) 2002-06-30 03:39:14 +00:00
Barry Warsaw 1969817486 Another test of long headers. 2002-06-29 15:23:39 +00:00
Barry Warsaw 9546e7972c Oleg Broytmann's support for RFC 2231 encoded parameters, SF patch #549133
New test cases.
2002-06-29 05:58:45 +00:00
Barry Warsaw 12566a8826 Oleg Broytmann's support for RFC 2231 encoded parameters, SF patch #549133
Specifically,

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

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

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

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

_get_params_preserve(): Decode the parameters before returning them.

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

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

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

Other changes include:

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

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

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

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

This closes SF bugs 498149 and 551273.

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

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

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

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

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

with test cases.

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

    slice()
    buffer()

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

This closes SF patch http://www.python.org/sf/562373
2002-06-06 09:48:13 +00:00
Raymond Hettinger c4c453f5ae Skip Montanaro's patch, SF 559833, exposing xrange type in builtins.
Also, added more regression tests to cover the new type and test its
conformity with range().
2002-06-05 23:12:45 +00:00
Piers Lauder f97b2d7dad open method changed to use arguments and set instance host/port values (instead of __init__) 2002-06-05 22:31:57 +00:00
Guido van Rossum d842e07470 SF bug 558179.
Change default for get() back to None.
Will backport to 2.2.1.
2002-06-05 19:07:39 +00:00
Jeremy Hylton dc8412e541 Move warning about directory not on sys.path to debug level.
Fix a bunch of multiline string constants that used +.
2002-06-04 21:20:08 +00:00
Jeremy Hylton 8f787bf1d0 Test changes before checking them in. 2002-06-04 21:11:56 +00:00
Jeremy Hylton 40ebbeff23 Track extra arg to option_table to all uses of it 2002-06-04 21:10:35 +00:00
Jeremy Hylton 6b3996b2b9 Replace bogus bare variables with attribute access. 2002-06-04 21:06:16 +00:00
Jeremy Hylton 115fdc614f Define DEBUG as early as possible to avoid import problems. 2002-06-04 21:05:05 +00:00
Jeremy Hylton 4f2f1335a8 Add missing import of log. 2002-06-04 21:04:03 +00:00
Jeremy Hylton 7146073850 Use module-level import of DEBUG instead of many function-level imports. 2002-06-04 21:02:26 +00:00
Jeremy Hylton fc861bab92 Remove unused imports 2002-06-04 21:00:33 +00:00
Jeremy Hylton 11a52708f7 Make None return explicit 2002-06-04 21:00:20 +00:00
Jeremy Hylton c58e984837 import base64 at the top to avoid two different imports at other times 2002-06-04 20:55:10 +00:00
Jeremy Hylton ec772744c7 ensure_filename() only takes one argument.
Call ensure_string() with one arg too, since the second value passed
was the default.
2002-06-04 20:45:17 +00:00
Jeremy Hylton adb2b38543 Reindent lines to improve readability 2002-06-04 20:42:41 +00:00
Jeremy Hylton 711f91cf83 Remove (commented out) options that have moved into the distribution. 2002-06-04 20:40:03 +00:00
Jeremy Hylton d003abccc7 get_script() implicitly returned None and also had explicit returns.
Make all returns explicit and rearrange logic to avoid extra
indentation.
2002-06-04 20:39:34 +00:00
Jeremy Hylton d53f6e43e7 global _option_order is not used 2002-06-04 20:35:10 +00:00
Jeremy Hylton e6f40ea4b6 Fix bug in recent change to logging code.
mode is not computed in dry_run mode, so it can't be included in the
log message.
2002-06-04 20:30:10 +00:00
Jeremy Hylton a2f9989c1a Fix unused local variables caught by pychecker.
Fixes a bug for Solaris pkgtool (bdist_pkgtool) that would have
prevented it from building subpackages.
2002-06-04 20:26:44 +00:00
Jeremy Hylton a181ec07af Set repeat metadata for an option based on repeat local var not
constant.
2002-06-04 20:24:05 +00:00
Jeremy Hylton 332a146127 Remove unused imports caught by pychecker 2002-06-04 20:18:24 +00:00
Jeremy Hylton cd8a1148e1 Make setup.py less chatty by default.
This is a conservative version of SF patch 504889.  It uses the log
module instead of calling print in various places, and it ignores the
verbose argument passed to many functions and set as an attribute on
some objects.  Instead, it uses the verbosity set on the logger via
the command line.

The log module is now preferred over announce() and warn() methods
that exist only for backwards compatibility.

XXX This checkin changes a lot of modules that have no test suite and
aren't exercised by the Python build process.  It will need
substantial testing.
2002-06-04 20:14:43 +00:00
Jeremy Hylton 6fa82a3477 A simple log mechanism styled after the proposed std library module 2002-06-04 20:00:26 +00:00
Guido van Rossum 9923ffe2c0 Address SF bug 519621: slots weren't traversed by GC.
While I was at it, I added a tp_clear handler and changed the
tp_dealloc handler to use the clear_slots helper for the tp_clear
handler.

Also tightened the rules for slot names: they must now be proper
identifiers (ignoring the dirty little fact that <ctype.h> is locale
sensitive).

Also set mp->flags = READONLY for the __weakref__ pseudo-slot.

Most of this is a 2.2 bugfix candidate; I'll apply it there myself.
2002-06-04 19:52:53 +00:00
Jeremy Hylton e22bc1e841 The comment said:
# XXX this isn't used anywhere, and worse, it has the same name as a method
 # in Command with subtly different semantics.  (This one just has one
 # source -> one dest; that one has many sources -> one dest.)  Nuke it?

Yes.  Nuke it.
2002-06-04 18:55:54 +00:00
Fred Drake 16c8d702a4 When using a Python that has not been installed to build 3rd-party
modules, distutils does not understand that the build version of the
source tree is needed.

This patch fixes distutils.sysconfig to understand that the running
Python is part of the build tree and needs to use the appropriate
"shape" of the tree. This does not assume anything about the current
directory, so can be used to build 3rd-party modules using Python's
build tree as well.

This is useful since it allows us to use a non-installed debug-mode
Python with 3rd-party modules for testing. It as the side-effect that
set_python_build() is no longer needed (the hack which was added to
allow distutils to be used to build the "standard" extension modules).

This closes SF patch #547734.
2002-06-04 15:28:21 +00:00
Walter Dörwald 474458da48 Add constants BOM_UTF8, BOM_UTF16, BOM_UTF16_LE, BOM_UTF16_BE,
BOM_UTF32, BOM_UTF32_LE and BOM_UTF32_BE that represent the Byte
Order Mark in UTF-8, UTF-16 and UTF-32 encodings for little and
big endian systems.

The old names BOM32_* and BOM64_* were off by a factor of 2.

This closes SF bug http://www.python.org/sf/555360
2002-06-04 15:16:29 +00:00
Guido van Rossum 1bdd9b033a Test repair now that module.__init__ requires a name and initializes
__name__ and __doc__.
2002-06-04 06:10:37 +00:00
Guido van Rossum bdabeccfb8 Repair the test (adding a docstring to the module type changed the
docstring for an uninitialized module object).
2002-06-04 06:06:54 +00:00
Guido van Rossum c3a787e090 Surprising fix for SF bug 563060: module can be used as base class.
Change the module constructor (module_init) to have the signature
__init__(name:str, doc=None); this prevents the call from type_new()
to succeed.  While we're at it, prevent repeated calling of
module_init for the same module from leaking the dict, changing the
semantics so that __dict__ is only initialized if NULL.

Also adding a unittest, test_module.py.

This is an incompatibility with 2.2, if anybody was instantiating the
module class before, their argument list was probably empty; so this
can't be backported to 2.2.x.
2002-06-04 05:52:47 +00:00
Raymond Hettinger 88f72ff955 Replace .keys() with .iteritems(). Second review and test by Alex. 2002-06-04 02:17:04 +00:00
Guido van Rossum 155a34d2e5 The warning filter was ineffective when this module was invoked as a
script.
2002-06-03 19:45:32 +00:00
Jeremy Hylton 40bbae3b03 Fix HTTPError __init__ for cases where fp is None.
The HTTPError class tries to act as a regular response objects for
HTTP protocol errors that include full responses.  If the failure is
more basic, like no valid response, the __init__ choked when it tried
to initialize its superclasses in addinfourl hierarchy that requires a
valid response.

The solution isn't elegant but seems to be effective.  Do not
initialize the base classes if there isn't a file object containing
the response.  In this case, user code expecting to use the addinfourl
methods will fail; but it was going to fail anyway.

It might be cleaner to factor out HTTPError into two classes, only one
of which inherits from addinfourl.  Not sure that the extra complexity
would lead to any improved functionality, though.

Partial fix for SF bug # 563665.

Bug fix candidate for 2.1 and 2.2.
2002-06-03 16:53:00 +00:00
Walter Dörwald 65230a2de7 Remove uses of the string and types modules:
x in string.whitespace => x.isspace()
type(x) in types.StringTypes => isinstance(x, basestring)
isinstance(x, types.StringTypes) => isinstance(x, basestring)
type(x) is types.StringType => isinstance(x, str)
type(x) == types.StringType => isinstance(x, str)
string.split(x, ...) => x.split(...)
string.join(x, y) => y.join(x)
string.zfill(x, ...) => x.zfill(...)
string.count(x, ...) => x.count(...)
hasattr(types, "UnicodeType") => try: unicode except NameError:
type(x) != types.TupleTuple => not isinstance(x, tuple)
isinstance(x, types.TupleType) => isinstance(x, tuple)
type(x) is types.IntType => isinstance(x, int)

Do not mention the string module in the rlcompleter docstring.

This partially applies SF patch http://www.python.org/sf/562373
(with basestring instead of string). (It excludes the changes to
unittest.py and does not change the os.stat stuff.)
2002-06-03 15:58:32 +00:00
Walter Dörwald a401ae4010 Fix a regression from the 1.68->1.69 checkin:
string.split(foo, bar) must be foo.split(bar) instead of bar.split(foo).
2002-06-03 10:41:45 +00:00
Tim Peters c5000dfc40 regrtest has a new
-f/--fromfile <filename>
option.  This runs all and only the tests named in the file, in the
order given (although -x may weed that list, and -r may shuffle it).
Lines starting with '#' are ignored.

This goes a long way toward helping to automate the binary-search-like
procedure I keep reinventing by hand when a test fails due to interaction
among tests (no failure in isolation, and some unknown number of
predecessor tests need to run first -- now you can stick all the test
names in a file, and comment/uncomment blocks of lines until finding a
minimal set of predecessors).
2002-06-02 21:42:01 +00:00
Barry Warsaw 69e18af968 _parsebody(): Fix for the new message/rfc822 tree structure (the
parent is now a multipart with one element, the sub-message object).
2002-06-02 19:12:03 +00:00
Barry Warsaw 2c68506604 Generator.__call__() => Generator.flatten()
Also, adjust to the new message/rfc822 tree layout.
2002-06-02 19:09:27 +00:00
Barry Warsaw d2b2e533c0 header_encode(), encode(): Use _floordiv() from the appropriate
compatibility module.
2002-06-02 19:08:31 +00:00
Barry Warsaw 21f77ac0bc Use absolute import paths for intrapackage imports. 2002-06-02 19:07:16 +00:00
Barry Warsaw 8ba76e8929 Use absolute import paths for intrapackage imports.
as_string(): Use Generator.flatten() for better performance.
2002-06-02 19:05:51 +00:00
Barry Warsaw 524af6f382 Use absolute import paths for intrapackage imports.
Use MIMENonMultipart as the base class so that you can't attach() to
these non-multipart message types.
2002-06-02 19:05:08 +00:00
Barry Warsaw 7dc865ad72 flatten(): Renamed from __call__() which is (silently) deprecated.
__call__() can be 2-3x slower than the equivalent normal method.

_handle_message(): The structure of message/rfc822 message has
changed.  Now parent's payload is a list of length 1, and the zeroth
element is the Message sub-object.  Adjust the printing of such
message trees to reflect this change.
2002-06-02 19:02:37 +00:00
Barry Warsaw ff49279f7c _intdiv2() -> _floordiv(), merge of uncommitted changes. 2002-06-02 18:59:06 +00:00
Raymond Hettinger e0d4972acc Replaced .keys() with dictionary iterators 2002-06-02 18:55:56 +00:00
Neal Norwitz 1fab9ee085 Get email test to pass. Barry, hope this is what you had in mind 2002-06-02 16:38:14 +00:00
Michael W. Hudson 1ccccc08c2 Make test_mhlib run again.
There's some wierdness here, but the test ran before and not after,
so I'm just hacking the change out.  Someone more motivated than
me can work out what's really happening.

Raymond: *PLEASE* run the test suite before checking things like
this in!
2002-06-02 16:12:06 +00:00
Martin v. Löwis 9ea6c19747 Patch #552060: Add SSLFakeSocket.sendall. Also committed for 2.2 maint. 2002-06-02 12:33:22 +00:00
Raymond Hettinger 10ff706e27 Replaced boolean tests with is None. 2002-06-02 03:04:52 +00:00
Raymond Hettinger f13eb55d59 Replace boolean test with is None. 2002-06-02 00:40:05 +00:00
Raymond Hettinger 32200aeac6 Replaced obsolete stat module constants with equivalent attributes 2002-06-01 19:51:15 +00:00
Raymond Hettinger 16e3c427f3 Replace boolean test with is None. 2002-06-01 16:07:16 +00:00
Raymond Hettinger 793d4b4936 SF 563203. Replaced 'has_key()' with 'in'. 2002-06-01 14:25:41 +00:00
Raymond Hettinger 54f0222547 SF 563203. Replaced 'has_key()' with 'in'. 2002-06-01 14:18:47 +00:00
Barry Warsaw 9d5e4aa414 Bump to version 2.0.5, and also use absolute import paths. 2002-06-01 06:03:09 +00:00
Barry Warsaw 2f514a806d These two classes provide bases for more specific content type
subclasses.

MIMENonMultipart: Base class for non-multipart/* content type subclass
specializations, e.g. image/gif.  This class overrides attach() which
raises an exception, since it makes no sense to attach a subpart to
e.g. an image/gif message.

MIMEMultipart: Base class for multipart/* content type subclass
specializations, e.g. multipart/mixed.  Does little more than provide
a useful constructor.
2002-06-01 05:59:12 +00:00
Barry Warsaw 1c30aa2292 The _compat modules now export _floordiv() instead of _intdiv2() for
better code reuse.

_split() Use _floordiv().
2002-06-01 05:49:17 +00:00
Barry Warsaw c5d1c045ab Slightly better docstring 2002-06-01 05:45:37 +00:00
Barry Warsaw bb98c8cff0 _is_unicode(): Use UnicodeType instead of the unicode builtin for
Python 2.1 compatibility.
2002-06-01 03:56:07 +00:00
Raymond Hettinger 936654bce0 Replaced boolean test with is None 2002-06-01 03:06:31 +00:00
Raymond Hettinger 094662a165 Replace boolean test with is None 2002-06-01 01:29:16 +00:00
Raymond Hettinger 0f4940c0a8 Replaced boolean test with 'is None' 2002-06-01 00:57:55 +00:00
Raymond Hettinger 8989ea6ce1 Use is None rather than general boolean 2002-06-01 00:06:20 +00:00
Raymond Hettinger a144900b86 Use is None rather than general boolean 2002-05-31 23:54:44 +00:00
Raymond Hettinger c0418609eb Use is None rather than general boolean 2002-05-31 23:03:33 +00:00
Raymond Hettinger 14bd6de0ec SF 560736. Optimize list iteration by filling the tp_iter slot. 2002-05-31 21:40:38 +00:00
Guido van Rossum 59b2a74c75 SF bug 533625 (Armin Rigo). rexec: potential security hole
If a rexec instance allows writing in the current directory (a common
thing to do), there's a way to execute bogus bytecode.  Fix this by
not allowing imports from .pyc files (in a way that allows a site to
configure things so that .pyc files *are* allowed, if writing is not
allowed).

I'll apply this to 2.2 and 2.1 too.
2002-05-31 21:12:53 +00:00
Neal Norwitz ebb4190709 Use string methods, remove import string 2002-05-31 20:51:31 +00:00
Neal Norwitz ab19962290 Use more string methods, remove import string 2002-05-31 20:46:39 +00:00
Raymond Hettinger 7fdfc2d231 Replace '== None' with 'is None' 2002-05-31 17:49:10 +00:00
Neal Norwitz 7616504dcf Fix printing plural (s or ""). 2002-05-31 14:15:11 +00:00
Neal Norwitz 5aee504ccb Remove import of re, it is not used 2002-05-31 14:14:06 +00:00
Neal Norwitz 7ce734cd72 Use string methods where possible, and remove import string 2002-05-31 14:13:04 +00:00
Jeremy Hylton 05ab2e693c Fix SF bug [ 561825 ] Confusing error for "del f()"
In the error message, say del for del and assign for everything else.
2002-05-31 14:08:29 +00:00
Andrew M. Kuchling 8c20916de2 Remove unneeded import 2002-05-30 19:15:16 +00:00
Jeremy Hylton 40b7703f1c Verify that the imp can find and load .py files. 2002-05-30 17:10:20 +00:00
Neal Norwitz efbb67b1a7 Remove comment about inheritance, look one line up 2002-05-30 12:12:04 +00:00
Raymond Hettinger 1dbe6c0728 Move statement out of comment block 2002-05-30 00:06:01 +00:00
Guido van Rossum ca948b40b4 Use floor division where appropriate. 2002-05-29 20:38:21 +00:00
Fred Drake 127ee1607f Minor cleanup:
- Add comment explaining the structure of the stack.
- Minor optimization: make stack tuple directly usable as part of return
  value for enter/exit events.
2002-05-29 19:40:36 +00:00
Raymond Hettinger aef22fb9cd Patch 560023 adding docstrings. 2.2 Candidate (after verifying modules were not updated after 2.2). 2002-05-29 16:18:42 +00:00
Neal Norwitz d68f5171eb As discussed on python-dev, add a mechanism to indicate features
that are in the process of deprecation (PendingDeprecationWarning).
Docs could be improved.
2002-05-29 15:54:55 +00:00
Neal Norwitz 72a2b4d43f Whitespace normalization 2002-05-29 00:54:38 +00:00
Guido van Rossum 1a7ac359a0 Importing Charset should not fail when Unicode is disabled. (XXX
Using Unicode-aware methods may still die with a NameError on unicode.
Maybe there's a more elegant solution but I doubt anybody cares.)
2002-05-28 18:49:03 +00:00
Christian Tismer 313a7513b0 This is a Python 2.1 and 2.2 bugfix candidate:
(or how do I "mark" something to be a candidate?)

fixed an old buglet that caused bdb to be unable to
continue in the botframe, after a breakpoint was set.
the key idea is not to set botframe to the bottom level frame,
but its f_back, which actually might be None.
Additional changes: migrated old exception trick to use
sys._getframe(), which exists both in 2.1 and 2.2 .

Note: I believe Mark Hammond needs to look over his code now.
F5 correctly starts up in the debugger, but later on doesn't stop at a given
breakpoint any longer.

kind regards - chris
2002-05-28 08:04:00 +00:00
Steven M. Gava 72de9c7a9c Geiger Ho's patch for better subclassing 2002-05-27 21:58:05 +00:00
Michael W. Hudson 34f20eac98 This is patch
[ 559250 ] more POSIX signal stuff

Adds support (and docs and tests and autoconfery) for posix signal
mask handling -- sigpending, sigprocmask and sigsuspend.
2002-05-27 15:08:24 +00:00
Chui Tey 5d2af63cc3 GvR's rpc patch 2002-05-26 13:36:41 +00:00
Guido van Rossum 9fc8a29663 Fix for SF bug 551412. When _PyType_Lookup() is called on a type
whose tp_mro hasn't been initialized, it would dump core.  Fix this by
checking for NULL and calling PyType_Ready().  Will fix this in 2.2.1
too.
2002-05-24 21:40:08 +00:00
Guido van Rossum 4b46c0a15f Don't require Unicode support. 2002-05-24 17:58:05 +00:00
Raymond Hettinger ef4d4bdc3c Whitespace normalized. 2002-05-23 23:58:17 +00:00
Raymond Hettinger c32f0336e0 Deprecated Random.cunifvariate clearing bug 506647. Also, added docstrings. 2002-05-23 19:44:49 +00:00
Tim Peters 8ac1495a6a Whitespace normalization. 2002-05-23 15:15:30 +00:00
Barry Warsaw f655328483 parseaddr(): Fixed in the same way that Message.getaddrlist() was
fixed (re: SF bug #555035).  Include a unittest.
2002-05-23 03:21:01 +00:00
Skip Montanaro 12424bc0ef force gzip module to open files using 'b'inary mode.
closes patch #536278.
2002-05-23 01:43:05 +00:00
Neal Norwitz d4e5be5340 Closes: #556025 seg fault when doing list(xrange(1e9))
A MemoryError is now raised when the list cannot be created.
There is a test, but as the comment says, it really only
works for 32 bit systems.  I don't know how to improve
the test for other systems (ie, 64 bit or systems
where the data size != addressable size,
e.g. 64 bit data, but 48 bit addressable memory)
2002-05-22 23:19:17 +00:00
Barry Warsaw 43193150ee Bump to version 2.0.4 2002-05-22 01:52:33 +00:00
Barry Warsaw 4be9eccbc4 getaddresses(): Like the change in rfc822.py, this one needs to access
the AddressList.addresslist attribute directly.

Also, add a test case for the email.Utils.getaddresses() interface.
2002-05-22 01:52:10 +00:00
Skip Montanaro 012ed5da5e add BooleanType 2002-05-21 23:17:12 +00:00
Guido van Rossum 5e355b244f In both spilldata() functions, pretend that the docstring for
non-callable objects is always None.  This makes for less confusing
output and fixes the problem reported in SF patch #550290.
2002-05-21 20:56:15 +00:00
Barry Warsaw 0a8d4d5736 Message.getaddrlist(): Use the AddressList.addresslist attribute
instead of calling the getaddrlist() method, since the latter doesn't
work with multiple calls (it will return the empty list for the second
and subsequent calls).

Closes SF bug #555035.  Include a unittest.
2002-05-21 19:46:13 +00:00
Raymond Hettinger 97394bc795 Patch 533291. Deprecate None return form of __reduce__. 2002-05-21 17:22:02 +00:00
Fred Drake 2513357c4b Munge the RCS keywords to avoid updates, so the version number matches that
of the PyUNIT version of the same file.  This helps people understand that
this version is the same as the version from the independent PyUNIT
release (confusion was indicated on the PyUNIT mailing list).
2002-05-21 03:49:00 +00:00
Michael W. Hudson 755f75eef8 Use types.StringTypes instead of explicit (str, unicode) list 2002-05-20 17:29:46 +00:00
Michael W. Hudson 7b7ba54033 Guess what? --disable-unicode proofing.
This is a strange test.
2002-05-20 14:54:17 +00:00
Michael W. Hudson f207277167 More --disable-unicode stuff.
I'm getting better at vi!
2002-05-20 14:48:16 +00:00
Michael W. Hudson 3704644acb Use types.StringTypes instead of (types.StringType, types.UnicodeType) --
works better (at all!) in --disable-unicode builds.

Bugfix candidate, probably.
2002-05-20 14:30:06 +00:00
Michael W. Hudson 9c373061ad tolerate --disable-unicode... 2002-05-20 14:24:53 +00:00
Michael W. Hudson 7c6a4ad78f More mindless --disable-unicode proofing. 2002-05-20 14:22:28 +00:00
Michael W. Hudson 286225b548 easy --disable-unicode proofing. 2002-05-20 14:15:42 +00:00
Barry Warsaw 6d86f8302f A test message w/ CRLF line endings 2002-05-19 23:53:38 +00:00
Barry Warsaw e0d85c834a Add two new tests of recent email package fixes: CRLF line endings,
and explicit maxlinelen arguments to the Header constructor.
2002-05-19 23:52:54 +00:00
Barry Warsaw 7e21b6792b I've thought about it some more, and I believe it is proper for the
email package's Parser to handle the three common line endings.
Certain protocols such as IMAP define CRLF line endings and it doesn't
make sense for the client app to have to normalize the line endings
before handing it message off to the Parser.

_parsebody(): Be more flexible in the matching of line endings for
finding the MIME separators.  Accept any of \r, \n and \r\n.  Note
that we do /not/ change the line endings in the payloads, we just
accept any of those three around MIME boundaries.
2002-05-19 23:51:50 +00:00
Barry Warsaw 812031b955 Fixed a bug in the splitting of lines, and improved the splitting for
single byte character sets.  Also fixed a semantic problem with the
constructor's default arguments.  Specifically,

__init__(): Change the maxlinelen argument default to None instead of
MAXLINELEN.  The semantics should have been (and now are) that if
maxlinelen is given it is always honored.  If it isn't given, but
header_name is given, then the maximum line length is calculated.  If
neither are given then the default 76 characters is used.

_split(): If the character set is a single byte character set then we
can split the line at the maxlinelen because we know that encoding the
header won't increase its length.  If the charset isn't a single byte
charset then we use the quicker divide-and-conquer line splitting
algorithm as before.
2002-05-19 23:47:53 +00:00
Barry Warsaw 8c1aac2476 Complete a merge of the mimelib project and the Python cvs codebases
for the email package.  The former is now just a shell project that
has some extra files for packaging for independent use (e.g. setup.py
and README).

Added a compatibility layer so that the same API can be used in Python
2.1 and 2.2/2.3 with the major differences shuffled off into helper
modules (_compat21.py and _compat22.py).

Also bumped the package version number to 2.0.3 for some fixes to be
checked in momentarily.
2002-05-19 23:44:19 +00:00
Raymond Hettinger 2ae87539aa Added Mitchell Surface's regression tests for base64. Closes patch #550002. 2002-05-18 00:25:10 +00:00
Michael W. Hudson 8bf46e4e7a This is patch
[ 555382 ] test_array v.s. --disable-unicode

+ MvL's suggestions.  Just the 32 failing tests in --disable-unicode builds
now...
2002-05-15 13:04:53 +00:00
Raymond Hettinger d1fa3db52d Added docstrings excerpted from Python Library Reference.
Closes patch 556161.
2002-05-15 02:56:03 +00:00
Chui Tey 55956c9361 Fixed bug: Split RPC message into two parts instead of three 2002-05-14 23:45:14 +00:00
Fred Drake 30d59baecd Simplify code to remove an unnecessary test. 2002-05-14 15:50:11 +00:00
Guido van Rossum 570764ddce Use spaces, not tabs for indents.
Raymond Hettinger, beware!  This caused the Unix install to fail!
2002-05-14 14:08:12 +00:00
Raymond Hettinger 2d2b51bf22 Added tests for new degree/radian conversions. 2002-05-14 08:51:33 +00:00
Raymond Hettinger b760efb08d Closes patch 529408 deprecating random.stdgamma(). 2002-05-14 06:40:34 +00:00
Barry Warsaw bdc8289e06 smtp_RCPT(): Removed a somewhat embarrassing debugging line, found by
Scot Stevenson.  Could be a bug fix candidate, but probably doesn't
matter much unless a certain blue-nosed cat suddenly becomes corporeal
and starts emailing some stmp.py (sic) fronted mailer.
2002-05-14 02:13:30 +00:00
Raymond Hettinger ca6cdc2c02 Closes SF bug 527139. Moved temp variables inside guard. 2002-05-13 23:40:14 +00:00
Guido van Rossum 4402241450 Jim Fulton reported a segfault in dir(). A heavily proxied object
returned a proxy for __class__ whose __bases__ was also a proxy.  The
merge_class_dict() helper for dir() assumed incorrectly that __bases__
would always be a tuple and used the in-line tuple API on the proxy.

I will backport this to 2.2 as well.
2002-05-13 18:29:46 +00:00
Guido van Rossum df4dabd5d2 SF 554663. Add OpenBSD3. Bugfix candidate if anyone cares. 2002-05-13 14:58:02 +00:00
Guido van Rossum 6a1bd39d8e SF 554073. Fix typo in error reporting of unrecognized character
following IAC.  Bugfix candidate if anyone cares.
2002-05-13 14:55:33 +00:00
Michael W. Hudson e1c67d1dc0 Make StringIO work in --disable-unicode builds... 2002-05-13 09:42:16 +00:00
Raymond Hettinger 64108afa60 Adds tests for degrees() and radians() functions added to mathmodule.
Closes patch 552452 and feature request 426539.
2002-05-13 03:55:01 +00:00
Tim Peters 39a86c2188 SF bug 555042: zip() may trigger MemoryError.
NOT a bugfix candidate:  this is a fix to an optimization introduced
in 2.3.
2002-05-12 07:19:38 +00:00
Raymond Hettinger e874fc304e Closes SF patch 553277. Per GvR, reverting to original patch -- the way to
test if 'callable' has not been supplied is to test for None instead of
False.  The previous correction to 'if callable()' was wrong because an unusable
callback would be ignored rather than raising an exception.
2002-05-12 05:53:51 +00:00
Jeremy Hylton e037665f99 Use isinstance() in preference to comparison of type by is. 2002-05-10 21:00:35 +00:00
Martin v. Löwis a8dd0941b8 Patch #553277: Accept callbacks that are callable, not callbacks that are true. 2002-05-08 08:56:33 +00:00
Andrew M. Kuchling 0b5c11252d Prevent convert_path from crashing if the path is an empty string. Bugfix candidate. 2002-05-06 13:57:19 +00:00
Tim Peters 46c04e140c random.gauss() uses a piece of hidden state used by nothing else,
and the .seed() and .whseed() methods failed to reset it.  In other
words, setting the seed didn't completely determine the sequence of
results produced by random.gauss().  It does now.  Programs repeatedly
mixing calls to a seed method with calls to gauss() may see different
results now.

Bugfix candidate (random.gauss() has always been broken in this way),
despite that it may change results.
2002-05-05 20:40:00 +00:00
Fred Drake e08fda912f Remove all tests that rely on deprecated-in-2.2 features of xrange objects.
"What's New in Python 2.2" documented that these would be removed in
Python 2.3.
2002-05-02 18:40:31 +00:00
Martin v. Löwis a066f46b9b Patch 550804: Make os.environ.copy() return a copy. 2002-05-02 17:39:19 +00:00
Fred Drake e0e890a4da Added regression tests for xrange object attributes.
See SF bug #551285.
2002-05-02 16:07:44 +00:00
Fred Drake 485f340d52 Buffer-object repitition and concatenation has worked all along; add a test
to make avoid regression.
2002-05-02 04:27:20 +00:00
Fred Drake 7f781c9aab Add Pickler.clear_memo() so the pickle and cPickle modules are more similar. 2002-05-01 20:33:53 +00:00
Andrew MacIntyre e41abab33b Fred's recent changes to support "-u all" resulted in subset resource
selections (eg "-u network") being ignored.
2002-04-30 12:11:04 +00:00
Tim Peters 67d687a114 builtin_zip(): Take a good guess at how big the result list will be,
and allocate it in one gulp.

This isn't a bugfix, it's just a minor optimization that may or may not
pay off.
2002-04-29 21:27:32 +00:00
Tim Peters 81b9251d59 Mostly in SequenceMatcher.{__chain_b, find_longest_match}:
This now does a dynamic analysis of which elements are so frequently
repeated as to constitute noise.  The primary benefit is an enormous
speedup in find_longest_match, as the innermost loop can have factors
of 100s less potential matches to worry about, in cases where the
sequences have many duplicate elements.  In effect, this zooms in on
sequences of non-ubiquitous elements now.

While I like what I've seen of the effects so far, I still consider
this experimental.  Please give it a try!
2002-04-29 01:37:32 +00:00
Guido van Rossum 7dab2426ca - New builtin function enumerate(x), from PEP 279. Example:
enumerate("abc") is an iterator returning (0,"a"), (1,"b"), (2,"c").
  The argument can be an arbitrary iterable object.
2002-04-26 19:40:56 +00:00
Fred Drake d451ec1cdb Clean up uses of some deprecated features.
Reported by Neal Norwitz on python-dev.
2002-04-26 02:29:55 +00:00
Thomas Heller 69d31b749d Pass the full pathname to MSVC when compiling a debug version. This
allows the debugger to find the source without asking the user to
browse for it.
2002-04-25 17:29:45 +00:00
Thomas Heller 378498dad6 Append the PC specific include 'PC' and library 'PCBuild' directories
under NT - this allows distutils to work with the CVS version or the
source distribution.

Wrap a long line.
2002-04-25 17:26:37 +00:00
Thomas Heller e65008038e Fix trivial typo. 2002-04-25 17:03:30 +00:00
Neil Schemenauer 3b04d635a2 Add more tests for abstract isinstance() and issubclass(). 2002-04-24 03:33:02 +00:00
Tim Peters 1e33ffa5c7 test_resource has no chance of running on Windows. 2002-04-23 23:09:02 +00:00
Tim Peters e12cda9840 test_mmap started breaking on Windows, only when run after test_bsddb.
On Win2K it thought 'foo' started at byte offset 0 instead of at the
pagesize, and on Win98 it thought 'foo' didn't exist at all.  Somehow
or other this is related to the new "in memory file" gimmicks in
bsddb, but the old bsddb we use on Windows sucks so bad anyway I don't
want to bother digging deeper.  Flushing the file in test_mmap after
writing to it makes the problem go away, so good enough.
2002-04-23 23:07:28 +00:00
Barry Warsaw 906569de24 Unit tests for the changes in abstract.c version 2.101. The debug
build's "undetected error" problems were originally detected with
extension types, but we can whitebox test the same situations with
new-style classes.
2002-04-23 22:48:42 +00:00
Barry Warsaw 5ca537473b Rewrote the PyUnit description so that it now recommends to use
run_suite() instead of run_unittest().  Best practice is to plan for
multiple test classes.
2002-04-23 21:39:00 +00:00
Jeremy Hylton 74ce77f0e6 Add tests for the recent resource module change.
Also add a test that Python doesn't die with SIGXFSZ if it exceeds the
file rlimit.  (Assuming this will also test the behavior when the 2GB
limit is exceed on a platform that doesn't have large file support.)
2002-04-23 20:21:22 +00:00
Barry Warsaw 8570013357 Whitespace normalization. Unka Timmy would be proud. 2002-04-23 18:18:43 +00:00
Guido van Rossum 256705bca7 SF patch 546244 by John Williams: add Text.dump() method. 2002-04-23 13:29:43 +00:00
Jack Jansen 1476c2753b There was a non-ascii character in the source. Replaced by a hex escape. 2002-04-23 10:52:44 +00:00
Anthony Baxter ae7639dbfb whitespace fixup. test__all__ and test_sundry were failing
for me on linux because of the inconsistent whitespace.
2002-04-23 02:38:39 +00:00
Anthony Baxter 4ce6b351cc don't fail if the audio device is busy, just skip.
SF patch 545486
2002-04-23 02:20:46 +00:00
Anthony Baxter 8388895fe4 SF patch [ 545523 ] patch for 514433 bsddb.dbopen (NULL)
closes SF #514433

can now pass 'None' as the filename for the bsddb.*open functions,
and you'll get an in-memory temporary store.

docs are ripped out of the bsddb dbopen man page. Fred may want to
clean them up.

Considering this for 2.2, but not 2.1.
2002-04-23 02:11:05 +00:00
Walter Dörwald de02bcb265 Apply patch diff.txt from SF feature request
http://www.python.org/sf/444708

This adds the optional argument for str.strip
to unicode.strip too and makes it possible
to call str.strip with a unicode argument
and unicode.strip with a str argument.
2002-04-22 17:42:37 +00:00
Jack Jansen 992d58b770 Fixes based on ideas from Christopher Smith:
- islink() now returns true for alias files
- walk() no longer follows aliases while traversing
- realpath() implemented, returning an alias-free pathname.

As this could conceivably break existing code I think it isn't a bugfix candidate.
2002-04-22 13:55:43 +00:00
Steven M. Gava a2bc259dd7 tracking python idle changes:
Provisional fix for writefile() [SF bug # 541730]
2002-04-22 00:42:42 +00:00
Steven M. Gava 931625dc77 tracking python idle changes:
Patch #540583: Open MS Help Docs if available.
2002-04-22 00:38:26 +00:00
Tim Peters 639295f0a5 Enable universal newlines on Windows. Note that NEWS needs more words! 2002-04-21 07:30:30 +00:00
Tim Peters ea572b21f8 Assorted code cleanups for readability. Greatly boosted the size of the
test data:  this test fails on WIndows now if universal newlines are
enabled (which they aren't yet, by default).  I don't know whether the
test will also fail on Linux now.
2002-04-21 06:12:02 +00:00
Martin v. Löwis 6af3e2dc31 Forward port of patch # 500311: Work around for buggy https servers.
Fixes #494762.
2002-04-20 07:47:40 +00:00
Jeremy Hylton 954aed8c8d Add test for eval() w/ free variables.
Related to SF bug #505315
2002-04-20 04:51:39 +00:00
Jeremy Hylton 8d22b0409b Fix com_arglist() and update grammar fragment.
SF bug #522264 reported by Evelyn Mitchell.

The code included a comment about "STAR STAR" which was translated
into the code as the bogus attribute token.STARSTAR.  This name never
caused an attribute error because it was never retrieved.  The code
was based on an old version of the grammar that specified kwargs as
two tokens ('*' '*').  I checked as far back as 2.1 and didn't find
this production.

The fix is simple, because token.DOUBLESTAR is the only token
allowed.  Also update the grammar fragment in com_arglist().

XXX I'll bet lots of other grammar fragments in comments are out of
date, probably in this module and in compile.c.
2002-04-19 22:56:37 +00:00
Jeremy Hylton c72737e7b6 Fix SF #544995 (zlib crash on second flush call)
Bug fix by mhammond.

Bug fix candidate for 2.2, not present in 2.1.
2002-04-19 14:37:07 +00:00
Mark Hammond 3b959dbcaf Fix bug 544473 - "Queue module can deadlock".
Use try/finally to ensure all Queue locks remain stable.
Includes test case.  Bugfix candidate.
2002-04-19 00:11:32 +00:00
Tim Peters afb2c80b29 ceval.c/do_raise(): Tighten the test to disallow raising an instance of
a str subclass.

test_descr.py/string_exceptions():  New sub-test.

For 2.3 only.  Guido doesn't want this backported.
2002-04-18 18:06:20 +00:00
Jeremy Hylton 16af557ae9 Remove more out-of-date comments and clarify explanation of visit(). 2002-04-18 16:26:40 +00:00
Jeremy Hylton 3b05c8ee4a Remove out-of-date explanation in doc strings,
as reported by Eric C. Newton.
2002-04-18 16:02:48 +00:00
Tim Peters 5379dea2a7 SF bug 544733: Cygwin test_mmap fix for Python 2.2.1
Close a file before trying to unlink it, and apparently Cygwin needs
writes to an mmap'ed file to get flushed before they're visible.

Bugfix candidate, but I think only for the 2.2 line (it's testing
features that I think were new in 2.2).
2002-04-18 04:30:18 +00:00
Guido van Rossum d99b3e78dd SF bug 542984.
Change type_get_doc (the get function for __doc__) to look in tp_dict
more often, and if it finds a descriptor in tp_dict, to call it (with
a NULL instance).  This means you can add a __doc__ descriptor to a
new-style class that returns instance docs when called on an instance,
and class docs when called on a class -- or the same docs in either
case, but lazily computed.

I'll also check this into the 2.2 maintenance branch.
2002-04-18 00:27:33 +00:00
Walter Dörwald 2ee4be0775 Apply diff3.txt from SF patch http://www.python.org/sf/536241
If a str or unicode method returns the original object,
make sure that for str and unicode subclasses the original
will not be returned.

This should prevent SF bug http://www.python.org/sf/460020
from reappearing.
2002-04-17 21:34:05 +00:00
Marc-André Lemburg 0538f1f2c7 Patch #531901 by Mark W. Alexander: adds a new distutils packager
base class (in bdist_packager) and two subclasses which make use
of this base class: bdist_pkgtool (for Solaris) and bdist_sdux (for
HP-UX).
2002-04-17 20:30:10 +00:00
Fred Drake 34f300a53e Added docstrings to the Profile class.
Avoid adding Python wrappers around the underlying C profiler if possible;
the extra layer of calls can lead to confusion in interpreting the logs.
2002-04-16 19:27:23 +00:00
Guido van Rossum e8fc640349 SF bug 544647.
PyNumber_InPlaceMultiply insisted on calling sq_inplace_repeat if it
existed, even if nb_inplace_multiply also existed and the arguments
weren't right for sq_inplace_repeat.  Change this to only use
sq_inplace_repeat if nb_inplace_multiply isn't defined.

Bugfix candidate.
2002-04-16 16:44:51 +00:00
Barry Warsaw 4eaf50f435 test_mktime(): Removed. This wasn't really testing anything useful
(or platform independent).  Closes SF bug #460357.

Bug fix candidate.
2002-04-16 12:37:55 +00:00
Barry Warsaw 16f9055a9b Whitespace normalization, while using non-whitespace literals for
intended whitespace.
2002-04-16 05:06:42 +00:00
Guido van Rossum 6184c117e9 Expect test_email_codecs to be skipped -- few users or developers will
have the needed optional Japanese codecs installed.
2002-04-16 02:14:04 +00:00
Tim Peters 27dba87b78 Apparently 3 of the tests here rely on trailing whitespace and/or hard
tab characters, so reverting the whitespace normalization.  Barry,
please repair this.
2002-04-16 02:08:51 +00:00
Tim Peters 4d9b466ea5 Fewer deprecation warnings. 2002-04-16 01:59:17 +00:00
Tim Peters d0cc4f0b49 resetwarnings(): Remove extra space from docstring guts. 2002-04-16 01:51:25 +00:00
Tim Peters 863ac44b74 Whitespace normalization. 2002-04-16 01:38:40 +00:00
Tim Peters c86c1b88f9 resetwarnings(): change the docstring to reflect what the code
actually does.  Note that the description in the Library Reference
manual is already accurate.

Bugfix candidate.
2002-04-16 01:33:59 +00:00
Tim Peters d392506c43 Tighten up some warning filters, and break some dependencies on the
order in which the tests are normally run.
2002-04-16 01:27:44 +00:00
Tim Peters 50ac30ee01 OK, don't call resetwarnings(). 2002-04-16 00:29:27 +00:00
Tim Peters 7d79948103 It makes more sense to call resetwarnings() after every test runs than
to keep doing that in every test that wants to filter a warning.
2002-04-16 00:01:09 +00:00
Tim Peters a91a02a76d I expect test_univnewlines to be skipped on Windows. I expect this
because it *is* skipped.  I'm not entirely sure it should be skipped, but
figuring that out would take actual thought <wink>.
2002-04-15 23:56:04 +00:00
Tim Peters f022a4d451 Reduce the number of test-suite DeprecationWarnings; start adding
resetwarnings() calls too.
2002-04-15 23:52:04 +00:00
Barry Warsaw c9ad32c5d1 test_main(): Added this so the test can actually get run under the
regrtest framework.  Keep the original standalone-unittest
scaffolding (i.e. suite() and __main__).
2002-04-15 22:14:06 +00:00
Barry Warsaw 24fd0252c4 parseaddr(): Don't use rfc822.parseaddr() because this now implies a
double call to AddressList.getaddrlist(), and /that/ always returns an
empty list for the second and subsequent calls.

Instead, instantiate an AddressList directly, and get the parsed
addresses out of the addresslist attribute.
2002-04-15 22:00:25 +00:00
Barry Warsaw be22ae6def ehlo(): A proper fix for SF bug #498572. RFC 1869 describes ESMTP
which requires that if there are ehlo parameters returned with an ehlo
keyword (in the response to EHLO), the keyword and parameters must be
delimited by an ASCII space.  Thus responses like

    250-AUTH=LOGIN

should be ignored as non-conformant to the RFC (the `=' isn't allowed
in the ehlo keyword).

This is a bug fix candidate.
2002-04-15 20:03:30 +00:00
Walter Dörwald 068325ef92 Apply the second version of SF patch http://www.python.org/sf/536241
Add a method zfill to str, unicode and UserString and change
Lib/string.py accordingly.

This activates the zfill version in unicodeobject.c that was
commented out and implements the same in stringobject.c. It also
adds the test for unicode support in Lib/string.py back in and
uses repr() instead() of str() (as it was before Lib/string.py 1.62)
2002-04-15 13:36:47 +00:00
Guido van Rossum b6b8942f53 SF bug #541883 (Vincent Fiack).
A stupid bug in object_set_class(): didn't check for value==NULL
before checking its type.

Bugfix candidate.
2002-04-15 01:03:30 +00:00
Guido van Rossum d1c08f33f2 Add exit as alias for quit, as the easiest way to address SF bug
#543674.

Bugfix candidate.
2002-04-15 00:48:24 +00:00
Guido van Rossum beae477767 SF bug #543318 (Frank J. Tobin).
In DatagramRequestHandler.setup(), the wfile initialization should be
StringIO.StringIO(), not StringIO.StringIO(slf.packet).

Bugfix candidate (all the way back to Python 1.5.2 :-).
2002-04-15 00:36:48 +00:00
Guido van Rossum a2da305211 Fix from SF bug #541980 (Jacques A. Vidrine).
When os.stat() for a file raises OSError, turn it into IOError per
documentation.

Bugfix candidate.
2002-04-15 00:25:01 +00:00
Tim Peters 077f27141f SF bug 543840: complex(string) accepts strings with \0
complex_subtype_from_string():  this stopped parsing at the first 0
byte, as if that were the end of the input string.

Bugfix candidate.
2002-04-14 22:04:03 +00:00
Jack Jansen 518d261f63 Test suite for universal newline support. 2002-04-14 20:17:18 +00:00
Jack Jansen 7b8c7546eb Mass checkin of universal newline support.
Highlights: import and friends will understand any of \r, \n and \r\n
as end of line. Python file input will do the same if you use mode 'U'.
Everything can be disabled by configuring with --without-universal-newlines.

See PEP278 for details.
2002-04-14 20:12:41 +00:00
Martin v. Löwis 2f6d4da278 Patch #542569: tp_print tp_repr tp_str in test_bool.py. 2002-04-14 10:22:29 +00:00
Neal Norwitz f42d32cb27 BDFL agreed with Tim: rehabilitate randint(). 2002-04-13 14:41:19 +00:00
Guido van Rossum f49562586f Add pop() to UserDict. 2002-04-13 14:03:38 +00:00
Guido van Rossum 018b0eb0f5 Partially implement SF feature request 444708.
Add optional arg to string methods strip(), lstrip(), rstrip().
The optional arg specifies characters to delete.

Also for UserString.

Still to do:

- Misc/NEWS
- LaTeX docs (I did the docstrings though)
- Unicode methods, and Unicode support in the string methods.
2002-04-13 00:56:08 +00:00
Barry Warsaw 56cdf11922 AddrlistClass -> AddressList 2002-04-12 20:55:31 +00:00
Barry Warsaw e1df15c401 AddrlistClass -> AddressList 2002-04-12 20:50:05 +00:00
Guido van Rossum d854f3b3cc I am mad. This test never worked!
The test function's signature should be

    test(methodname, input, output, *args)

but the output argument was omitted.  This caused all tests to fail,
because the expected output was passed as the initial argument to the
method call.  But because of the way the test works (it compares the
results for a regular string to the results for a UserString instance
with the same value, and it's OK if both raise the same exception) the
test never failed!

I've fixed this, and also cleaned up a few warts in the verbose
output.  Finally, I've made it possible to run the test stand-alone in
verbose mode by passing -v as a command line argument.

Now, the test will report failure related to zfill.  That's not my
fault, that's a legitimate problem: the string_tests.py file contains
a test for the zfill() method (just added) but this method is not
implemented.  The responsible party will surely fix this soon now.
2002-04-12 16:25:39 +00:00
Guido van Rossum e027d9818f Add Raymond Hettinger's d.pop(). See SF patch 539949. 2002-04-12 15:11:59 +00:00
Fred Drake 04a8da5cdb Clean up the "all" support for -u. 2002-04-11 20:58:54 +00:00
Fred Drake f9ddec41ce Guido sez to remove the deprecation warning for a year.
The deprecation is now listed in PEP 4.
2002-04-11 20:57:30 +00:00
Tim Peters a7c2b303d4 Since xmllib is deprecated now, suppress the DeprecationWarning its test
module necessarily raises.
2002-04-11 20:18:40 +00:00
Tim Peters b05cd496df Ignore more deprecation warnings. 2002-04-11 20:04:12 +00:00
Tim Peters 3c14efe696 Stop sucking up xmllib -- it's deprecated. 2002-04-11 19:54:11 +00:00
Tim Peters deb121aec7 I don't expect test_email_codecs to run on Windows. 2002-04-11 19:52:58 +00:00
Fred Drake 3a15dace36 Added the resource name "all" to enable all of the optional resource uses.
This is nice for use with "make TESTOPTS='-u all' test".
2002-04-11 16:39:16 +00:00
Fred Drake 43735da1bf Improve coverage of Objects/weakrefobject.c. 2002-04-11 03:59:42 +00:00
Andrew M. Kuchling 7301907358 Add deprecation warning to 'pre' module 2002-04-10 21:36:11 +00:00
Andrew M. Kuchling 7fd1c8c880 Remove support for importing 'pre' module 2002-04-10 21:15:40 +00:00
Barry Warsaw 409a4c08b5 Sync'ing with standalone email package 2.0.1. This adds support for
non-us-ascii character sets in headers and bodies.  Some API changes
(with DeprecationWarnings for the old APIs).  Better RFC-compliant
implementations of base64 and quoted-printable.

Updated test cases.  Documentation updates to follow (after I finish
writing them ;).
2002-04-10 21:01:31 +00:00
Marc-André Lemburg ce0b664af2 Added test case for UTF-8 encoding bug #541828. 2002-04-10 17:18:02 +00:00
Andrew M. Kuchling a9745611de Use random instead of whrandom 2002-04-10 14:54:39 +00:00
Neal Norwitz ab3b9eb477 Add deprecation warnings for modules as documented 2002-04-10 02:04:00 +00:00
Fred Drake 6e99704fcf Add a deprecation warning to reflect the documented deprecation of the
whrandom module.  (The deprecation was effective in Python 2.1.)
2002-04-10 01:45:11 +00:00
Neal Norwitz 803a8ea47e Update docstring to reflect code change to bool 2002-04-09 18:12:58 +00:00
Thomas Heller 4c7fb96b7a Remove unconditional debugging prints. 2002-04-09 14:16:07 +00:00
Thomas Heller fd0e82a385 Set the warn_dir option to 0 before running the install command.
This suppresses bogus warnings about modules installed into a directory
not in sys.path.

Bugfix candidate.
2002-04-09 14:14:38 +00:00
Martin v. Löwis 8509ebc8f7 Patch #539392: Invoke setlocale, try opening the file in demo mode. 2002-04-08 14:51:31 +00:00
Martin v. Löwis d1a3c8117d Move knee.py from Lib/ to Demo/imputil/. Fixes #515745. 2002-04-07 16:29:36 +00:00
Guido van Rossum 8ca162f417 Partial introduction of bools where appropriate. 2002-04-07 06:36:23 +00:00
Guido van Rossum 8ace1ab53a - Changed new-style class instantiation so that when C's __new__
method returns something that's not a C instance, its __init__ is
  not called.  [SF bug #537450]
2002-04-06 01:05:01 +00:00
Guido van Rossum d1bfe5e5fd Add tests for binary pickles. 2002-04-05 20:57:02 +00:00
Guido van Rossum e276339cea Implement an idea by Paul Rubin:
Change pickling format for bools to use a backwards compatible
encoding.  This means you can pickle True or False on Python 2.3
and Python 2.2 or before will read it back as 1 or 0.  The code
used for pickling bools before would create pickles that could
not be read in previous Python versions.
2002-04-05 19:30:08 +00:00
Marc-André Lemburg 3ccb09cba3 Fix for bug #222395: UTF-16 et al. don't handle .readline().
They now raise an NotImplementedError to hint to the truth ;-)
2002-04-05 12:12:00 +00:00
Tim Peters a863270f04 Revert 0/1 -> False/True change; I didn't intend to muck w/ distutils. 2002-04-04 23:17:31 +00:00
Tim Peters bc0e910826 Convert a pile of obvious "yes/no" functions to return bool. 2002-04-04 22:55:58 +00:00
Jeremy Hylton f32e459125 Replace use of apply() with extended call syntax. 2002-04-04 21:02:24 +00:00
Fred Drake df6eca7eb7 Support manual proxy configuration for simple urlopen() operations.
This change is similar to the supplied patch, but does not save the opener
when a proxy configuration is specified.
This closes SF patch #523415.
2002-04-04 20:41:34 +00:00
Fred Drake da204daeaa Not sure why the regression test missed this, but the PyXML tests caught it.
We should get attributes from the right object.
2002-04-04 19:12:31 +00:00
Fred Drake 012c81fc97 Avoid creating circular references between the ExpatParser and the
ContentHandler.  While GC will eventually clean up, it can take longer than
normal for applications that create a lot of strings (or other immutables)
rather without creating many containers.
This closes SF bug #535474.
2002-04-04 17:57:08 +00:00
Guido van Rossum 2e1c09c1fd Removed old Digital Creations copyright/license notices (with
permission from Paul Everitt).  Also removed a few other references to
Digital Creations and changed the remaining ones to Zope Corporation.
2002-04-04 17:52:50 +00:00
Guido van Rossum 065fa4142a Add test case for SF bug 534347. 2002-04-04 16:27:04 +00:00
Guido van Rossum 5f8203679d Oops. Here are the new files. My apologies. 2002-04-03 23:01:45 +00:00
Guido van Rossum 77f6a65eb0 Add the 'bool' type and its values 'False' and 'True', as described in
PEP 285.  Everything described in the PEP is here, and there is even
some documentation.  I had to fix 12 unit tests; all but one of these
were printing Boolean outcomes that changed from 0/1 to False/True.
(The exception is test_unicode.py, which did a type(x) == type(y)
style comparison.  I could've fixed that with a single line using
issubtype(x, type(y)), but instead chose to be explicit about those
places where a bool is expected.

Still to do: perhaps more documentation; change standard library
modules to return False/True from predicates.
2002-04-03 22:41:51 +00:00
Mark Hammond e7fefbf68d Fix bugs:
457466: popenx() argument mangling hangs python
 226766: popen('python -c"...."') tends to hang

Fixes argument quoting in w9xpopen.exe for Windows 9x.  w9xpopen.exe
also never attempts to display a MessageBox when not executed
interactively.

Added test_popen() test.  This test currently just executes
"python -c ..." as a child process, and checks that the expected
arguments were all recieved correctly by the child process.  This
test succeeds for me on Win9x, win2k and Linux, and I hope it does
for other popen supported platforms too :)
2002-04-03 01:47:00 +00:00
Guido van Rossum 155db9aa22 SF patch 537536 by Phillip J. Eby, fix for SF bug 535444, super()
broken w/ classmethods.

Bugfix candidate.
2002-04-02 17:53:47 +00:00
Guido van Rossum 64e5aa9391 Fix for a bug in the fix for SF bug 503031. This time the OP verified
that it works.

Bugfix candidate (this and the previous checkin, obviously).
2002-04-02 14:38:16 +00:00
Fred Drake aee113d368 Add an experimental mechanism to support extending the pprint formatting.
Partly responds to SF bug #505152.
2002-04-02 05:08:35 +00:00
Fred Drake 4993c51b94 Make test_commands work on more systems. This removes much of the dependency
on how a system is configured.
This closes SF bug #497160 (which has the patch) and #460613.

Bugfix candidate.
2002-04-01 23:56:03 +00:00
Neal Norwitz 05c09d08f9 Format strings (tuples,) appropriately 2002-04-01 19:01:39 +00:00
Neal Norwitz 28bb572ab4 Use attributes appropriately 2002-04-01 19:00:50 +00:00
Neal Norwitz b1295da59e There is no TestError, use TestFailed appropriately 2002-04-01 18:59:20 +00:00
Tim Peters de14a30d1d We expect to skip the new test_mpz on Windows. 2002-04-01 05:04:46 +00:00
Neal Norwitz 02098fa56b Get rid of all METH_OLDARGS & PyArg_Parse.
Fix floating point exception if mpz.powm(10, 1, 0) (modulus == 0).
Add a test.
2002-04-01 01:37:14 +00:00
Tim Peters 496563a514 Remove some now-obsolete generator future statements.
I left the email pkg alone; I'm not sure how Barry would like to handle
that.
2002-04-01 00:28:59 +00:00
Neal Norwitz 62f5a9d6c2 Convert file.readinto() to stop using METH_OLDARGS & PyArg_Parse.
Add test for file.readinto().
2002-04-01 00:09:00 +00:00
Guido van Rossum b955d6c41e Hopeful fix for SF bug 503031: urllib.py: open_http() host problem.
I really can't test this, but from reading the discussion in that bug
report, it's likely that this works.  It may also close a whole bunch
of other bug reports related to urllib and proxies on Windows, but who
knows.
2002-03-31 23:38:48 +00:00
Neal Norwitz 93cf79fde4 Use docstrings for exception classes 2002-03-31 14:06:41 +00:00
Neal Norwitz f74e46cf47 Derive exception classes from Exception 2002-03-31 13:59:18 +00:00
Neal Norwitz 27a353020b Stop using string exceptions 2002-03-31 13:58:20 +00:00
Andrew M. Kuchling f4a4fb9a11 [Patch #536769] Add -Xcompiler flag for adding arguments and switches for
the compiler
2002-03-29 18:00:19 +00:00
Andrew M. Kuchling eddd68d56c As part of fixing bug #536241, add a test case for string.zfill() with Unicode 2002-03-29 16:21:44 +00:00
Andrew M. Kuchling 102d1208a8 [Bug #536241] string.zfill() produces mangled output for a Unicode string.
Walter Doerwald provided a patch, which I've modified in two ways:

1) (Uncontroversial) Removed code to make module work in earlier versions of
   Python without the unicode() built-in

2) (Poss. controversial) Instead of making string.zfill take the repr()
   of non-string objects, take the str().

Should a warning be added to this branch of the code so that the automatic
str() can be deprecated?

2.2.2 bugfix candidate, assuming the repr()->str() change is deemed OK.
2002-03-29 16:20:33 +00:00
Andrew M. Kuchling c6c9c4a10f Add two tests for string.zfill 2002-03-29 16:00:13 +00:00
Jeremy Hylton b4c17c8992 Fix getcomments() so that it doesn't fail with TypeErrors.
It appears that getcomments() can get called for classes defined in
C.  Since these don't have source code, it can't do anything useful.
A function buried many levels deep was raising a TypeError that was
not caught.

Who knows why this broke...
2002-03-28 23:01:56 +00:00
Tim Peters d4ce758505 test_trashcan: reword obscure code.
Bugfix candidate.
2002-03-28 21:22:25 +00:00
Tim Peters d222559cdb New test_traschcan() test in test_gc, which reliably provokes segfaults
under 2.0, 2.1 and 2.2.

Bugfix candidate.
2002-03-28 21:08:30 +00:00
Martin v. Löwis 0c0d56a22f Reindent. 2002-03-28 16:26:40 +00:00
Fred Drake f841aa6fc0 Add a simple test of the METH_CLASS and METH_STATIC flags for type methods. 2002-03-28 15:49:54 +00:00
Martin v. Löwis 4157ffbb96 Patch #536117: Typo in turtle.py.
2.2.2 candidate.
2002-03-28 15:45:57 +00:00
Martin v. Löwis 4208d4f757 Destroy and unlink deleted NoteBook panes. Fixes #516703.
2.2.2 candidate.
2002-03-27 17:59:17 +00:00
Martin v. Löwis f2041b8aa6 Ignore widgets with unknown names in winfo_children. Fixes #518283.
2.2.2 candidate.
2002-03-27 17:15:57 +00:00
Steven M. Gava 1d46e40f58 further work on new config system;
recent files menu
2002-03-27 08:40:46 +00:00
Steven M. Gava 0c5bc8c951 further work on new config system;
user defined help items
2002-03-27 02:25:44 +00:00
Steven M. Gava cedd30b030 _finally_ tracked down and eliminated a major problem
in PyShell.py that was causing extreme headaches in
working on EditorWindow.py
2002-03-27 00:51:53 +00:00
Neil Schemenauer 908632a6a6 Implement iterator protocol. 2002-03-26 20:28:40 +00:00
Barry Warsaw 13e34f7a19 __init__(): We'll try to be more RFC 2821 compliant by providing for a
better local_hostname default.  According to RFC 2821, it is
recommended that the fqdn hostname be provided in the EHLO/HELO verb
and if that can't be calculated, to use a domain literal.

The rationale for this change is documented in SF patch #497736 which
also had privacy concerns about leaking the fqdn in the EHLO/HELO.  We
decided this wasn't a big concern because no user data is leaked, and
the IP will always be leaked.  The local_hostname argument is provided
for those clients that are super paranoid.

Using localhost.localdomain may break some strict smtp servers so we
decided against using it as the default.
2002-03-26 20:27:35 +00:00
Neal Norwitz aad1849e25 time and socket were already imported in the module, no need to re-import 2002-03-26 16:25:01 +00:00
Neal Norwitz 1ae2875336 re was already imported in the module, no need to re-import 2002-03-26 16:23:28 +00:00
Neal Norwitz f261223ccd os was already imported in the module, no need to re-import 2002-03-26 16:21:52 +00:00
Neal Norwitz e98d16e8a4 Cleanup x so it is not left in module 2002-03-26 16:20:26 +00:00
Guido van Rossum 85ee491b3a Fix for SF 502085.
Don't die when issubclass(t, TypeType) fails.

Bugfix candidate (but I think it's too late for 2.2.1).
2002-03-26 00:51:56 +00:00
Skip Montanaro acb29aed67 make default banner match what the real interpreter displays 2002-03-25 22:04:23 +00:00
Skip Montanaro 0679a73c0e remove unqualified excepts - catch ImportError when trying to import
readline and get rid of string exception fallback when showing syntax
errors.
see bug 411881
2002-03-25 21:44:07 +00:00
Skip Montanaro 0897f0c4f8 eliminate unqualified except when checking for presence of LC_MESSAGES
see bug 411881
2002-03-25 21:40:36 +00:00
Skip Montanaro a959a36288 tighten up unqualified except in currentframe()
see bug 411881
2002-03-25 21:37:54 +00:00
Walter Dörwald dbd2d2560c Add tests for the iterkeys, itervalues and iteritems
methods in dict-proxy objects.
2002-03-25 18:36:32 +00:00
Barry Warsaw 4b186aff48 SMTP.__init__(): Fixed minor typo in docstring. 2002-03-25 04:00:38 +00:00
Neil Schemenauer cddc1a0249 Quote href properly. 2002-03-24 23:11:21 +00:00
Neil Schemenauer d69711cb1e Remove unnecessary \b. It was causing the RE to miss the tailing
slash on strings like "http://www.python.org/ is good".
2002-03-24 23:02:07 +00:00
Neil Schemenauer 153cc0fddc If possible, set FD_CLOEXEC flag on file descriptors opened using
TemporaryFile.  This flag causes the fd to be closed on exec().
2002-03-24 22:21:48 +00:00
Skip Montanaro 1c90d7ab3c tighten up except - os.close only raises OSError
see bug 411881
2002-03-24 20:48:26 +00:00
Tim Peters 8e5fd53be0 SF bug 480215: softspace confused in nested print
This fixes the symptom, but PRINT_ITEM has no way to know what (if
anything) PyFile_WriteObject() writes unless the object being printed
is a string.  When the object isn't a string, this fix retains the
guess that softspace should be set after PyFile_WriteObject().
We might want to say that it's the job of filelike-object write methods
to leave the file's softspace in the correct state.  That would probably
be better -- but everyone relies on PRINT_ITEM to guess for them now.
2002-03-24 19:25:00 +00:00
Skip Montanaro f3f87f743e oops - export InvalidURL in __all__ 2002-03-24 16:56:45 +00:00
Skip Montanaro 74e77e89de add test for InvalidURL 2002-03-24 16:54:38 +00:00
Skip Montanaro 03ff86da25 add test of InvalidURL 2002-03-24 16:54:16 +00:00
Skip Montanaro 9d38997e8c add InvalidURL exception - raised if port is given but empty or non-numeric 2002-03-24 16:53:50 +00:00
Skip Montanaro 1ce0073a4e tighten up except - in this context, AttributeError is the only exception
that can be raised - do_help won't be called if arg is not a string
2002-03-24 16:34:21 +00:00
Neil Schemenauer 6730f26cb0 Add local_hostname option to SMTP.__init__. If supplied, it is used
as the fully qualified local hostname.
2002-03-24 15:30:40 +00:00
Neil Schemenauer 03f3ee6d89 Try /var/mail before trying /usr/mail. Most new systems use /var.
This in inside the test so it really doesn't matter much.  Closes
SF patch 497097.
2002-03-24 01:38:38 +00:00
Neil Schemenauer eff724490f Add more tests for built-in types. Add tests for buffer objects.
Closes SF patch 494871.
2002-03-24 01:24:54 +00:00
Neil Schemenauer f06f8530f1 Use linecache for loading source code. Closes SF patch 490374. 2002-03-23 23:51:04 +00:00
Neil Schemenauer dbab3e3178 Add namespace selection for rlcompleter. Closes SF patch 490026. 2002-03-23 23:44:51 +00:00
Neil Schemenauer d03c342b99 Flush stdout before reading next command. Closes SF bug 526357. 2002-03-23 20:43:59 +00:00
Skip Montanaro 91cc17d20e Only AttributeError can be raised in this situation - on systems without
getuid or getpid.  posix_getuid & posix_getpid never raise exceptions when
called with no args.
2002-03-23 05:58:52 +00:00
Skip Montanaro 3c4a629bdc import statements only raise ImportError, right? 2002-03-23 05:55:18 +00:00
Skip Montanaro db5d1444a1 tighten up except - only ValueError can be raised in this situation 2002-03-23 05:50:17 +00:00
Skip Montanaro 3c643d8db3 tighten up except - int() only raises ValueError 2002-03-23 05:47:31 +00:00
Skip Montanaro 6ec967d066 added RFC 2396 tests from Aaron Swartz included in bug # 450225.
converted to use unittest
2002-03-23 05:32:10 +00:00
Skip Montanaro b1ba6b0044 no longer needed - converted test_urlparse.py to use unittest 2002-03-23 05:29:59 +00:00
Tim Peters 0c2c8e77fb SF bug 533234: tm_isdst > 1 Passed to strftime.
One more time on this turkey, but duller instead of cleverer.

Curious:  The docs say __getslice__ has been deprecated since 2.0, but
list.__getitem__ still doesn't work if you pass it a slice.  This makes
it a lot clearer to emulate a list by *being* a list <wink>.

Bugfix candidate.  Michael, just pile this patch on top of the others
that went by -- no need to try to pick these apart.
2002-03-23 03:26:53 +00:00
Skip Montanaro 07c57d4e60 better solution for bug #533234 courtesy of Tim.
Michael: use this version as the bugfix candidate...
2002-03-22 18:35:51 +00:00
Skip Montanaro e8c6a3eef6 guarantee that the dst flag of synthetic "time" tuples passed to strftime
is always 0.  This closes bug #533234.
2002-03-22 18:07:49 +00:00
Walter Dörwald 92b48b739f use stat attributes instead of tuple entries
and remove the unneccessary "import stat" statement.
2002-03-22 17:30:38 +00:00
Andrew M. Kuchling b26ca9db2e Revert part of previous patch: several install_* subcommands expect
.compile to be None, and set it to true if it is.
    Caught by Pearu Peterson.

Bugfix candidate, if the previous change is accepted for
release22-maint.
2002-03-22 15:35:17 +00:00
Andrew M. Kuchling 76fffd81e9 Add a simple test suite for netrc.py, and remove it from test_sundry 2002-03-22 02:48:57 +00:00
Andrew M. Kuchling 366a1df7f1 [Bug #532115] netrc module was broken
* 'macdef' (macro definition) wasn't parsed correctly
   * account value not reset for a subsequent 'default' line
   * typo: 'whitepace' -> 'whitespace'

Bugfix candidate.
2002-03-22 02:46:41 +00:00
Andrew M. Kuchling 3f1822b468 Add missing Boolean options
Remove unused no_compile flag
Initialize the Boolean attribute .compile to 0 instead of None

Bugfix candidate.
2002-03-21 23:46:54 +00:00
Andrew M. Kuchling da9f0bf4dd Add unlisted Boolean options. Thomas H., can you please check that I
got this right?

Bugfix candidate, unless Thomas notes a problem.
2002-03-21 23:44:01 +00:00
Andrew M. Kuchling 5de82a855e [Bug #517451] bdist_rpm didn't list all of its Boolean options.
(Someone should check the other commands for this same error.)

Bugfix candidate.
2002-03-21 23:27:54 +00:00
Walter Dörwald b25c2b0a4a [Apply SF patch #504943]
This patch makes it possible to pass Warning instances as the first
argument to warnings.warn. In this case the category argument
will be ignored. The message text used will be str(warninginstance).
2002-03-21 10:38:40 +00:00
Martin v. Löwis 047c05ebc4 Do not insert characters for unicode-escape decoders if the error mode
is "ignore". Fixes #529104.
2002-03-21 08:55:28 +00:00
Andrew M. Kuchling bdf1f19fee [Apply patch #500457 from the PyXML tracker]
Add iterator support to pulldom.DOMEventStream

New feature, so not a bugfix candidate (though it should be safe for inclusion)
2002-03-20 23:56:34 +00:00
Tim Peters bcc2c125f8 Change raw "except:" constructs to pass on KeyboardInterrupt.
Bugfix candidate?  Don't know -- never bothered me, but it's minor
either way.
2002-03-20 19:32:03 +00:00
Neil Schemenauer cacbdf6229 Make GzipFile an iterator. Closes bug #532621. 2002-03-20 18:36:00 +00:00
Andrew M. Kuchling c63a396c5f A faster version of the find_prefix_at_end() function (that I found in the
last Medusa release)

Should be safe as a bugfix candidate, though it's not fixing a bug.
2002-03-20 02:22:58 +00:00
Andrew M. Kuchling a3c0b9334e [Bug #531616] Make HTTPS work again by adding a sendall method to the
FakeSocket class.  Without it, the sendall() call got the method on
the underlying socket object, and that messed up SSL.

Does httplib use other methods of sockets that FakeSocket doesn't support?
Someone should take a look...  (I'll try to give it a once-over.)

2.2.1 bugfix candidate.
2002-03-18 22:51:48 +00:00
Andrew M. Kuchling 56a42356b7 To make 'urllib.py -t' run again, change FTP URL to a file that actually
exists.
2002-03-18 22:18:46 +00:00
Michael W. Hudson bd3e771a97 amk's fix attached to
[ 516299 ] urlparse can get fragments wrong
2002-03-18 13:06:00 +00:00
Martin v. Löwis 5c137c2251 Patch #495598: add an -q (quiet) option to pycompile. 2002-03-18 12:44:08 +00:00
Martin v. Löwis 73f570ba08 Correctly set default entry in all cases. 2002-03-18 10:43:18 +00:00
Martin v. Löwis d22368ffb3 Patch #499513: use readline() instead of readlines(). Removed the
unnecessary redirection limit code which is already in FancyURLopener.
2002-03-18 10:41:20 +00:00
Martin v. Löwis 9d3eba87d6 Patch #525870: Avoid duplicate stat calls, use st_ attributes. 2002-03-18 08:37:19 +00:00
Guido van Rossum 7e30548285 Fix for SF bug 528132 (Armin Rigo): classmethod().__get__() segfault
The proper fix is not quite what was submitted; it's really better to
take the class of the object passed rather than calling PyMethod_New
with NULL pointer args, because that can then cause other core dumps
later.

I also added a testcase for the fix to classmethods() in test_descr.py.

I've already applied this to the 2.2 branch.
2002-03-18 03:09:06 +00:00
Skip Montanaro c99475e7a0 dump the string exception fallback for anydbm.error. 2002-03-18 03:07:20 +00:00
Skip Montanaro 4894a97e22 initial test_anydbm module - based on test_dumbdbm.py 2002-03-18 03:00:37 +00:00
Steven M. Gava dbfe92cd27 further work on dynamic reconfiguration;
keybindings
2002-03-18 02:38:44 +00:00
Paul Prescod b845f3b4dd netrc will now raise a more predictable exception when $HOME is not set
(as it is often not on Windows). The code was always designed so that it
would raise an IOError if there was no .netrc. But if there was no $HOME
it would return a KeyError which would be somewhat unexpected for code
that didn't know the algorithm it used to find .netrc. The particular
code that triggered this problem for me was ftpmirror.py which handled
the IOError gracefully, but not the KeyError.
2002-03-18 02:13:48 +00:00
Skip Montanaro c08fe82b32 restructure a bit to not rely on test case execution ordering
add test case for bug #482460
2002-03-17 23:03:42 +00:00
Jack Jansen 03d3e33af9 Regenerated for Irix 6.5. 2002-03-17 21:49:20 +00:00
Jack Jansen 5ae73c8f75 Patch by Michael Pruett: make regen work on Irix 6.0 and 6.5. 2002-03-17 21:46:48 +00:00
Tim Peters 2400831773 SF patch 530070: pydoc regression, from Martin and Guido.
Change the way __doc__ is handled, to avoid blowing up on non-string
__doc__ values.
2002-03-17 18:56:20 +00:00
Martin v. Löwis 587c98c863 Patch #430706: Persistent connections in BaseHTTPServer. 2002-03-17 18:37:22 +00:00
Fred Drake 15b6893d95 Wrap a couple of long lines. 2002-03-15 14:37:23 +00:00
Skip Montanaro 1b9c177c5d Corrected _localized_name.__getitem__ based on code in patch 503202 (which I
thought was just a bug report, so didn't notice - doh!).  This handles
slicing, which v 1.23 didn't.
2002-03-15 13:52:43 +00:00
Martin v. Löwis 95700f7cde Patch #527427: minidom fails to use NodeList sometimes. 2002-03-15 13:51:59 +00:00
Jack Jansen e89f128a60 Skip test_longexp for MacPython on Mac OS X. It triggers a pathological realloc slowdown. Some tests with shorter expressions lead me to the conclusion that it will eventually finish, but it may take a few weeks:-)
2.2.1 candidate.
2002-03-15 13:50:54 +00:00
Jack Jansen ff0a7b8ca2 If no webbrowsers were found _tryorder would be empty, cmd would never be set and the "del cmd" would fail. Fixed.
2.2.1 candidate.
2002-03-15 13:47:32 +00:00
Michael W. Hudson e5363b7de5 .... 2002-03-15 10:21:59 +00:00
Michael W. Hudson ce00b735cd Fix
[ 530236 ] os.py assumes existence of statvfs_resul

This was pretty dense of me.  Sorry.

2.2.1 candidate.
2002-03-15 10:18:58 +00:00
Skip Montanaro 4c8349592d make _localized_name instances work more like the tuples they replaced. In
particular, negative indexes work and they are limited by the actual length
of the names they represent (weekday and month names).  This closes bug
#503202.
2002-03-15 04:08:38 +00:00
Skip Montanaro 693c6c44c4 added test case to catch index errors with _localized_name class 2002-03-15 03:57:04 +00:00
Skip Montanaro b32302176e first cut at skip-list for hp-ux 11 based upon input from Bill Lawler at HP. 2002-03-15 02:54:03 +00:00
Neal Norwitz 9672901742 Remove duplicate "import os" 2002-03-14 23:48:18 +00:00
Guido van Rossum 8c84255316 "Fix" for SF bug #520644: __slots__ are not pickled.
As promised in my response to the bug report, I'm not really fixing
it; in fact, one could argule over what the proper fix should do.
Instead, I'm adding a little magic that raises TypeError if you try to
pickle an instance of a class that has __slots__ but doesn't define or
override __getstate__.  This is done by adding a bozo __getstate__
that always raises TypeError.

Bugfix candidate (also the checkin to typeobject.c, of course).
2002-03-14 23:05:54 +00:00
Neal Norwitz 8a11f5dc7b SF #515015, raise exception if code not found in findsource() 2002-03-13 03:14:26 +00:00
Guido van Rossum d70356729f Test for the fix I just checked in to moduleobject.c.
Bugfix candidate.
2002-03-12 20:43:31 +00:00
Skip Montanaro 57fd45ea07 back out spurious change from 1.22 2002-03-12 19:48:03 +00:00
Skip Montanaro 59b40c0828 Popen3 and Popen4 should be in __all__ 2002-03-12 19:16:19 +00:00
Fred Drake 8b68862680 Set/update self.cwd properly. 2002-03-12 14:26:37 +00:00
Tim Peters 8f01b680c8 Change Windows file.truncate() to (a) restore the original file position,
and (b) stop trying to prevent file growth.

Beef up the file.truncate() docs.

Change test_largefile.py to stop assuming that f.truncate() moves the
file pointer to the truncation point, and to verify instead that it leaves
the file position alone.  Remove the test for what happens when a
specified size exceeds the original file size (it's ill-defined, according
to the Single Unix Spec).
2002-03-12 03:04:44 +00:00
Steven M. Gava 9d142adfce fixes to tabwidth code removal 2002-03-12 02:33:52 +00:00
Steven M. Gava 63f6714c3a remove tabwidth (for tabs) config stuff,
because of the way the tk text widget handles
tabs they must remain a fixed size in idle
2002-03-12 00:52:42 +00:00
Steven M. Gava b1585417d1 further work on dynamic config changes;
editor font
2002-03-12 00:21:56 +00:00
Neal Norwitz 1af5e35a98 Fix typo 2002-03-11 14:44:12 +00:00
Guido van Rossum c9e9e40b7b Add a check that SF bug 516727 is really fixed. 2002-03-11 13:21:25 +00:00
Martin v. Löwis db04489953 Patch #443899: Check modes on files before performing operations.
Use IOErrors where file objects use them.
2002-03-11 06:46:52 +00:00
Tim Peters fb05db2cae file_truncate(): provide full "large file" support on Windows, by
dropping MS's inadequate _chsize() function.  This was inspired by
SF patch 498109 ("fileobject truncate support for win32"), which I
rejected.

libstdtypes.tex:  Someone who knows should update the availability
blurb.  For example, if it's available on Linux, it would be good to
say so.

test_largefile:  Uncommented the file.truncate() tests, and reworked to
do more.  The old comment about "permission errors" in the truncation
tests under Windows was almost certainly due to that the file wasn't open
for *write* access at this point, so of course MS wouldn't let you
truncate it.  I'd be appalled if a Unixish system did.

CAUTION:  Someone should run this test on Linux (etc) too.  The
truncation part was commented out before.  Note that test_largefile isn't
run by default.
2002-03-11 00:24:00 +00:00
Guido van Rossum 15d529aec5 Bugfix candidate.
Adapter from SF patch 528038; fixes SF bug 527816.

The wrapper for __nonzero__ should be wrap_inquiry rather than
wrap_unaryfunc, since the slot returns an int, not a PyObject *.
2002-03-11 00:07:13 +00:00
Martin v. Löwis b5255114d1 Access the exception argument to see whether it starts with '500'.
Fixes #527855.
2002-03-10 15:59:58 +00:00
Tim Peters d674e17e96 SF patch 499062: Minor typo in test_generators.py.
There's no actual patch there.  It's an objection that Guido's example
doesn't actually generator "leaves", so change the comment that says
it does.
2002-03-10 07:59:13 +00:00
Jeremy Hylton 3921ff675e Fix SF bug 525520.
Don't automatically add a Host: header if the headers passed to
request() already has a Host key.
2002-03-09 06:07:23 +00:00
Jeremy Hylton 547a3167be Fix pyclbr test of httplib without really understanding pyclbr.
It seems that the new class HTTP11 in httplib.test() isn't
discoverable by pyclbr, which causes this test to fail.
2002-03-08 21:31:59 +00:00
Jeremy Hylton 8acf1e0e01 SF bug report #405939: wrong Host header with proxy
In August, Greg said this looked good, so I'm going ahead with it.

The fix is different from the one in the bug report.  Instead of using
a regular expression to extract the host from the url, I use
urlparse.urlsplit.

Martin commented that the patch doesn't address URLs that have basic
authentication username and password in the header.  I don't see any
code anywhere in httplib that supports this feature, so I'm not going
to address it for this fix.

Bug fix candidate.
2002-03-08 19:35:51 +00:00
Andrew M. Kuchling 7dd5f3cf69 [Bug #491820] Define two abstract methods to shut up Pychecker, and for
documentation purposes.  These implementations are the same as the
    ones suggested by Skip in the bug report.
2002-03-08 18:27:11 +00:00
Andrew M. Kuchling cc5f5b2686 [Bug #517554] When a signal happens during the select call in
asyncore.poll, the select fails with EINTR, which the
	code catches. However, the code fails to clear the
	r/w/e arrays (like poll3 does), which means it acts as
	if every descriptor had received all possible events.

Bug report and patch by Cesar Eduardo Barros
2002-03-08 18:19:59 +00:00
Andrew M. Kuchling 1bf71172f8 As part of fixing bug #523301, add a simple test of ConfigParser.write() 2002-03-08 18:10:12 +00:00
Andrew M. Kuchling 00824ed733 [Bug #523301] ConfigParser.write() produces broken output for values that
were originally rfc822-like line continuations.
   Modified version of a patch from Matthias Ralfs.
2002-03-08 18:08:47 +00:00
Piers Lauder 95f8495de8 fixed missing IMAP4_SSL_PORT 2002-03-08 09:05:12 +00:00
Tim Peters c9ffa068d1 SF bug 515943: searching for data with \0 in mmap.
mmap_find_method():  this obtained the string to find via s#, but it
ignored its length, acting as if it were \0-terminated instead.

Someone please run on Linux too (the extended test_mmap works on Windows).

Bugfix candidate.
2002-03-08 05:43:32 +00:00
Skip Montanaro 31fd86c4f1 add Content-Type header to error responses
this closes patch 502080
2002-03-08 02:36:18 +00:00
Piers Lauder a4f8313cbb add SSL class submitted by Tino Lange 2002-03-08 01:53:24 +00:00
Skip Montanaro df708788b6 add repr_str as alias for repr_string in both HTMLRepr and TextRepr classes
- reflects the change in type("").__name__ between 2.1 and 2.2.  The
__name__ field is used to find a method to call for particular types.
2002-03-07 22:58:02 +00:00
Michael W. Hudson 02b28ec316 Test for
[ 526039 ] devious code can crash structseqs

Bugfix candidate.
2002-03-06 17:18:15 +00:00
Michael W. Hudson 0e02530a79 Special support for pickling os.stat and os.stat_vfs results portably
(the types come from different modules on different platforms).

Added tests for pickling these types.

May be a bugfix candidate.
2002-03-06 17:11:18 +00:00
Martin v. Löwis b786e61b1c Set default value for readlines.sizehint to None. Change needed for 2.2.1
as well.
2002-03-05 15:46:38 +00:00
Michael W. Hudson 7bb466a1a5 A fix & test for
[ 496873 ] structseqs unpicklable

by adding a __reduce__ method to structseqs.

Will also commit this to the 2.2.1 branch momentarily.
2002-03-05 13:27:58 +00:00
Steven M. Gava dfd0b296d7 remove debug cruft 2002-03-05 00:31:43 +00:00
Steven M. Gava f31eec0e2e further work on new config system 2002-03-05 00:25:58 +00:00
Barry Warsaw 5833baa309 Removed two unused imports. Closes patch #525225.
2.2.1 candidate (but not terribly important).
2002-03-03 22:46:46 +00:00
Neal Norwitz 290d31e2fc SF #506611, fix sys.setprofile(), sys.settrace() core dumps
when no arguments are passed
2002-03-03 15:12:58 +00:00
Andrew MacIntyre 54e0eabc2d OS/2 more program behaves like Win32 more
(see patch #514490, by Stefan Schwarzer)
2002-03-03 03:12:30 +00:00
Steven M. Gava b77d343bc8 First work on making config changes dynamic,
dynamic theme changes
2002-03-02 07:16:21 +00:00
Tim Peters 5329cdb3ce _PyLong_Copy(): was creating a copy of the absolute value, but should
copy the sign too.  Added a test to test_descr to ensure that it does.

Bugfix candidate.
2002-03-02 04:18:04 +00:00
Barry Warsaw ffd05ee90d Added PortableUnixMailbox to the __all__ variable, and in the __main__
section use this class instead of UnixMailbox as per the comments in
the latter's class.

Bug fix candidate for 2.2.1.
2002-03-01 22:39:14 +00:00
Guido van Rossum 2eb0b87d14 SF patch 514641 (Naofumi Honda) - Negative ob_size of LongObjects
Due to the bizarre definition of _PyLong_Copy(), creating an instance
of a subclass of long with a negative value could cause core dumps
later on.  Unfortunately it looks like the behavior of _PyLong_Copy()
is quite intentional, so the fix is more work than feels comfortable.

This fix is almost, but not quite, the code that Naofumi Honda added;
in addition, I added a test case.
2002-03-01 22:24:49 +00:00
Martin v. Löwis 9986633609 Patch 520694: arraymodule.c improvements:
- make array.array a type
- add Py_UNICODE arrays
- support +=, *=
2002-03-01 10:27:01 +00:00
Guido van Rossum 88b666ca3f SF patch 518765 (Derek Harland): Bug in copy.py when used through
rexec.

When using a restricted environment, imports of copy will fail with an
AttributeError when trying to access types.CodeType.

Bugfix candidate (all the way back to 1.5.3, but at least 2.1.3 and
2.2.1).
2002-02-28 23:19:52 +00:00
Martin v. Löwis 51e234aa68 Patch #522279: transformer.py nodes shadows global. 2002-02-28 17:48:48 +00:00
Martin v. Löwis 1c63f6e489 Correct various errors:
- Use substring search, not re search for user-agent and paths.
- Consider * entry last. Unquote, then requote URLs.
- Treat empty Disallow as "allow everything".
Add test cases. Fixes #523041
2002-02-28 15:24:47 +00:00
Marc-André Lemburg bbea4717bc Allow shebang's which use versioned Python binaries. Fixes
bug #521526.
2002-02-28 09:16:21 +00:00
Guido van Rossum 06ee2531a8 SF patch #523169, by Samuele Pedroni.
There were never tests for the fact that list() always returns a *new*
list object, even when the argument is a list, while tuple() may
return a reference to the argument when it is a tuple.  Now there are.
2002-02-26 22:39:23 +00:00
Steven M. Gava 67716b5f53 bugfix for the problem where EditorWindow instances
would appear to freeze for a few seconds on closing
in some cases when running under X
2002-02-26 02:31:03 +00:00
Guido van Rossum bdba32051b canonic(): Fix by Edward K Ream to make breakpoints work better on
Windows: apply normcase() as well as abspath().  (Note: this isn't
needed to make IDLE work, but it's a good idea anyway.)

Bugfix candidate -- both 2.2.1 and 2.1.3.
2002-02-25 23:23:24 +00:00
Guido van Rossum 16ac99a959 Fix by Edward K Ream to make breakpoints work on Windows: insert a
missing call to self.canonic().
2002-02-25 23:22:08 +00:00
Martin v. Löwis 4ca196dd8d Set TCL_LIBRARY before import _tkinter. Suggested by Kirill Simonov.
Fixes #418173 and #219960. 2.2.1 candidate.
2002-02-24 16:51:45 +00:00
Martin v. Löwis 3356766abf Accept Unicode strings as SMTP TO addresses. Fixes #521270.
2.2.1 candidate.
2002-02-24 15:07:24 +00:00
Andrew MacIntyre 5cef57131f OS/2 EMX port Library and regression test changes:
Lib/
    os.py
    os2emxpath.py   // added - OS/2 EMX specific path manipulation routines
    popen2.py
    site.py
  Lib/test/
    test_fcntl.py
    test_longexp.py
2002-02-24 05:32:32 +00:00
Steven M. Gava 75a8e65873 tracking changes to python idle:
python Patch #520483: Make IDLE OutputWindow handle Unicode.
2002-02-23 23:27:08 +00:00
Martin v. Löwis 0ac16ec149 Patch #521714: fix pychecker warnings in ast.py. 2002-02-23 22:35:33 +00:00
Martin v. Löwis 9d51fc8972 Patch #521670: Remove unused sys import. 2002-02-23 22:31:53 +00:00
Andrew MacIntyre f47d60ffec Create and populate OS/2 EMX port platform specific library directory:
Lib/plat-os2emx/
    IN.py
    SOCKET.py
    grp.py
    pwd.py       // pwd module that can process real passwd files
    regen
2002-02-22 11:06:30 +00:00