Commit Graph

6257 Commits

Author SHA1 Message Date
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