Commit Graph

23146 Commits

Author SHA1 Message Date
Guido van Rossum 1c63a59b0d Actualized descrintro.html URL. 2002-07-09 18:44:09 +00:00
Tim Peters 6045d48e5c New file to try to document the "special build" preprocessor symbols.
Incomplete.  Add to it!  Once it settles down, it would make a nice
appendix in the real docs.
2002-07-09 18:35:34 +00:00
Tim Peters 34b2569327 _Py_AskYesNo(): Removed this function. It was defined only in a
Py_TRACE_REFS build, but wasn't referenced.
2002-07-09 18:22:55 +00:00
Barry Warsaw c53b29e2a7 ndiffAssertEqual(): Stringify the arguments before running
.splitlines() on them, since they may be Header instances.

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

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

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

Also, update a bunch of docstrings.
2002-07-09 16:33:47 +00:00
Thomas Heller 6b17abf6c0 Fix SF Bug 564931: compile() traceback must include filename. 2002-07-09 09:23:27 +00:00
Fred Drake 4254cbd29c Note that unicode() can raise LookupError for unknown codecs.
Closes SF bug #513666.
2002-07-09 05:25:46 +00:00
Fred Drake eab5f8a43d Remove unused variable. 2002-07-09 03:24:32 +00:00
Tim Peters 7c321a80f9 The Py_REF_DEBUG/COUNT_ALLOCS/Py_TRACE_REFS macro minefield: added
more trivial lexical helper macros so that uses of these guys expand
to nothing at all when they're not enabled.  This should help sub-
standard compilers that can't do a good job of optimizing away the
previous "(void)0" expressions.

Py_DECREF:  There's only one definition of this now.  Yay!  That
was that last one in the family defined multiple times in an #ifdef
maze.

Py_FatalError():  Changed the char* signature to const char*.

_Py_NegativeRefcount():  New helper function for the Py_REF_DEBUG
expansion of Py_DECREF.  Calling an external function cuts down on
the volume of generated code.  The previous inline expansion of abort()
didn't work as intended on Windows (the program often kept going, and
the error msg scrolled off the screen unseen).  _Py_NegativeRefcount
calls Py_FatalError instead, which captures our best knowledge of
how to abort effectively across platforms.
2002-07-09 02:57:01 +00:00
Barry Warsaw f6caeba03a Anthony Baxter's patch for non-strict parsing. This adds a `strict'
argument to the constructor -- defaulting to true -- which is
different than Anthony's approach of using global state.

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

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

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

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

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

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

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

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

A bunch of new tests checking the corner cases for multipart/digest
and message/rfc822.
2002-07-09 02:38:24 +00:00
Barry Warsaw e5270aea23 New files which test the corners of multipart/message and
message/rfc822 compliance.
2002-07-09 02:36:10 +00:00
Barry Warsaw 27b168ca7c With the addition of Oleg's support for RFC 2231, it's time to bump
the version number to 2.1.
2002-07-09 02:13:10 +00:00
Tim Peters c6a3ff634a SF bug 578752: COUNT_ALLOCS vs heap types
Repair segfaults and infinite loops in COUNT_ALLOCS builds in the
presence of new-style (heap-allocated) classes/types.

Bugfix candidate.  I'll backport this to 2.2.  It's irrelevant in 2.1.
2002-07-08 22:11:52 +00:00
Jack Jansen d1b2045958 The readme file said that OSX Carbon modules were only built for
-enable-framework builds, but setup.py built them anyway. Fixed.
Also normalized whitespace.

Bugfix candidate.
2002-07-08 21:39:36 +00:00
Tim Peters 623fdb9884 PyNode_AddChild() and fancy_roundup(): Be paranoid about int overflow. 2002-07-08 19:11:07 +00:00
Neil Schemenauer cccd1e7248 Remove the configure option for disabling the reference cycle GC. 2002-07-08 14:47:12 +00:00
Fred Drake c6a525e993 Fix typo reported by Kent Engström, and a bunch of broken markup. 2002-07-08 14:42:22 +00:00
Fred Drake 50e1286c00 Fix typo: "an Unicode string" --> "a Unicode string"
Clarify the return value when the parameter is a Unicode object.
2002-07-08 14:29:05 +00:00
Fred Drake 82bac5952f Fixed a typo and updated information about using the Times fonts when
formatting PostScript documents.  Reported by Dave Kuhlman.
2002-07-08 14:10:41 +00:00
Fred Drake 388fba8504 Added font-setting line (and associated comments) to the A4 version of
this file; the lack of this was causing the A4 version of tutorial to
use really bad Type 3 fonts instead of Type 1 fonts, which also
bloated the file size substantially.

I thought there was a SourceForge bug for this, but couldn't find it.
2002-07-08 14:08:48 +00:00
Jack Jansen c361f94e1c Got rid of symlink target, and in stead have "make dontinstallmacsubtree"
which uses a .pth file to add the Mac/Lib from your source tree to sys.path.

Also put the Python version number in a variable.Killed by signal 2.
2002-07-08 13:34:23 +00:00
Fred Drake e6691efa0f Change the "__ private" names to "_ protected"; this has been a pain for
subclassing so many times it should simply be changed.
2002-07-08 12:28:06 +00:00
Jack Jansen 1695bcb848 Got rid of special case for Macintosh realloc slowdown: Tim fixed the problem. 2002-07-08 10:07:25 +00:00
Jack Jansen 77d0717fb3 Define WITH_PYMALLOC as 1 2002-07-08 10:05:23 +00:00
Tim Peters 755ebea23b PyNode_AddChild(): Do aggressive over-allocation when the number of
children gets large, to avoid severe platform realloc() degeneration
in extreme cases (like test_longexp).

Bugfix candidate.

This was doing extremely timid over-allocation, just rounding up to the
nearest multiple of 3.  Now so long as the number of children is <= 128,
it rounds up to a multiple of 4 but via a much faster method.  When the
number of children exceeds 128, though, and more space is needed, it
doubles the capacity.  This is aggressive over-allocation.

SF patch <http://www.python.org/sf/578297> has Andrew MacIntyre using
PyMalloc in the parser to overcome platform malloc problems in
test_longexp on OS/2 EMX.  Jack Jansen notes there that it didn't help
him on the Mac, because the Mac has problems with frequent ever-growing
reallocs, not just with gazillions of teensy mallocs.  Win98 has no
visible problems with test_longexp, but I tried boosting the test-case
size and soon got "senseless" MemoryErrors out of it, and soon after
crashed the OS:  as I've seen in many other contexts before, while the
Win98 realloc remains zippy in bad cases, it leads to extreme
fragmentation of user address space, to the point that the OS barfs.

I don't yet know whether this fixes Jack's Mac problems, but it does cure
Win98's problems when boosting the test case size.  It also speeds
test_longexp in its unaltered state.
2002-07-08 06:32:09 +00:00
Jack Jansen 059ed83cc3 - Got rid if WITH_CYCLE_GC
- Cleaned up Python banner string, so the normal build for MacPython 2.3
  will have a short banner.
2002-07-07 20:54:44 +00:00
Tim Peters 4be93d0e84 Rearranged and added comments to object.h, to clarify many things
that have taken me "too long" to reverse-engineer over the years.
Vastly reduced the nesting level and redundancy of #ifdef-ery.
Took a light stab at repairing comments that are no longer true.

sys_gettotalrefcount():  Changed to enable under Py_REF_DEBUG.
It was enabled under Py_TRACE_REFS, which was much heavier than
necessary.  sys.gettotalrefcount() is now available in a
Py_REF_DEBUG-only build.
2002-07-07 19:59:50 +00:00
Jeremy Hylton 144dea3e05 Fix from SF patch #527518: proxy config with user+pass authentication.
Bug fix candidate.
2002-07-07 16:57:35 +00:00
Tim Peters a6269a8ec5 Removed 3 unlikely #includes that were only needed for the non-gc flavor
of the trashcan code.
2002-07-07 16:52:50 +00:00
Jeremy Hylton 6d0a4c79cf Fix for SF bug #432621: httplib: multiple Set-Cookie headers
If multiple header fields with the same name occur, they are combined
according to the rules in RFC 2616 sec 4.2:

Appending each subsequent field-value to the first, each separated by
a comma. The order in which header fields with the same field-name are
received is significant to the interpretation of the combined field
value.
2002-07-07 16:51:37 +00:00
Tim Peters 803526b9e2 Trashcan cleanup: Now that cyclic gc is always there, the trashcan
mechanism is no longer evil:  it no longer plays dangerous games with
the type pointer or refcounts, and objects in extension modules can play
along too without needing to edit the core first.

Rewrote all the comments to explain this, and (I hope) give clear
guidance to extension authors who do want to play along.  Documented
all the functions.  Added more asserts (it may no longer be evil, but
it's still dangerous <0.9 wink>).  Rearranged the generated code to
make it clearer, and to tolerate either the presence or absence of a
semicolon after the macros.  Rewrote _PyTrash_destroy_chain() to call
tp_dealloc directly; it was doing a Py_DECREF again, and that has all
sorts of obscure distorting effects in non-release builds (Py_DECREF
was already called on the object!).  Removed Christian's little "embedded
change log" comments -- that's what checkin messages are for, and since
it was impossible to correlate the comments with the code that changed,
I found them merely distracting.
2002-07-07 05:13:56 +00:00
Tim Peters 943382c8e5 Removed WITH_CYCLE_GC #ifdef-ery. Holes:
+ I'm not sure what to do about configure.in.  Left it alone.

+ Ditto pyexpat.c.  Fred or Martin will know what to do.
2002-07-07 03:59:34 +00:00
Jeremy Hylton 12f4f35f6e Fix SF bug #575360
Subclasses of Exception that define an __init__ must call
Exception.__init__ or define self.args.  Otherwise, str() will fail.

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

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

   And we would expect HTTP/1.1 clients to:

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

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

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

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

XXX strict needs to be documented.
2002-07-06 18:48:07 +00:00
Kurt B. Kaiser 889f8bf259 Modifying EditorWindow causes breakpoints in that module to be removed
from both sides of the split debugger.
M Debugger.py
M EditorWindow.py
2002-07-06 04:22:25 +00:00
Kurt B. Kaiser 491892b25e Decent burial for venerated ancestor (urn in attic) 2002-07-06 01:20:51 +00:00
Kurt B. Kaiser 1d5cec4fd2 Remove dead code. 2002-07-06 01:07:15 +00:00
Kurt B. Kaiser a3436d253c 1. Test Sourceforge checkin, idle-dev posting
2. Remove extraneous comment
2002-07-06 00:51:33 +00:00
unknown ed813bff29 Combine OldStackViewer.py with Debugger.py, removing dead code.
M Debugger.py       : Incorporate StackViewer, NamespaceViewer classes
M StackViewer.py    : remove import OldStackViewer
U OldStackViewer.py : remove file
2002-07-05 22:05:24 +00:00
Tim Peters ba78bc4a32 printlist(): Replaced the guts with a call to textwrap. Yay! 2002-07-04 19:45:06 +00:00
Michael W. Hudson 8b7f131f8b gc_list_move defined but not used. 2002-07-04 17:11:36 +00:00
Greg Ward e807e571a1 Docstring improvements. In particular, added docstrings for the
standalone wrap() and fill() functions.  This should address the
misunderstanding that led to SF bug 577106.
2002-07-04 14:51:49 +00:00
Thomas Heller 291e9ee341 Fix a typo. 2002-07-04 08:36:53 +00:00
Steve Holden b1af86a1d7 Revise asyncore documentation and document asynchat for the first time. 2002-07-03 18:36:39 +00:00