Commit Graph

23017 Commits

Author SHA1 Message Date
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
Fred Drake df872a2052 No need to be ambiguous about *how* extended slices and built-in types
have changed.

Uncomment a heading so that PendingDeprecationWarning doesn't seem so
out of place.
2002-07-03 12:02:01 +00:00
Fred Drake 228f6e4e7a Fix up a few more consistency nits and incorrectly applied markup.
Further clarify the English-centricity of fix_sentence_endings.
2002-07-03 05:08:48 +00:00
Barry Warsaw 6ee7156996 append(): Clarify the expected type of charset. 2002-07-03 05:04:04 +00:00
Kurt B. Kaiser f50d0f96a2 Debugger Exception Info and GUI Stack Exception Traceback: finish
implementation.
2002-07-03 03:55:43 +00:00
Tim Peters 1de41bfbc0 Stop trying to cater to platforms with a broken HUGE_VAL definition. It
breaks other platforms (in this case, the hack for broken Cray systems in
turn caused failure on a Mac system broken in a different way).
2002-07-03 03:31:20 +00:00
Mark Hammond 60ae701b3a Update freeze to use zlib 1.1.4.
From patch: [ 574532 ] Update freeze to use zlib 1.1.4
2002-07-03 02:40:25 +00:00
Fred Drake c412617779 Add annotations that describe the change in the "errors" and "failures"
attributes of the TestResult.
2002-07-02 22:46:42 +00:00
Fred Drake 387c8b5f37 Update the documentation of the errors and failures attributes of the
TestResult object.  Add an example of how to get even more information for
apps that can use it.
Closes SF bug #558278.
2002-07-02 22:34:44 +00:00
Tim Peters 934c1a1c6b Another stab at SF 576327: zipfile when sizeof(long) == 8
binascii_crc32():  The previous patch forced this to return the same
result across platforms.  This patch deals with that, on a 64-bit box,
the *entry* value may have "unexpected" bits in the high four bytes.

Bugfix candidate.
2002-07-02 22:24:50 +00:00
Tim Peters aab713bdf7 visit_decref(): Added another assert. 2002-07-02 22:15:28 +00:00
Greg Ward 285f4a7db7 Don't list all the keyword args to the TextWrapper constructor in the
classdesc -- just use "..." with prose explaining the correspondence
between keyword args and instance attributes.

Document 'width' along with the other instance attributes.

Describe default values consistently.

Typo fixes.
2002-07-02 21:48:12 +00:00
Fred Drake cadb9eb8f6 Be consistent with the functions in the posix/nt module: docstrings
don't include a " -> None" for functions that have no return value.
2002-07-02 21:28:04 +00:00
Fred Drake 2c22e85ae7 Attempt to clarify removedirs().
Based on SF bug #574773.
2002-07-02 21:03:49 +00:00
Fred Drake ca23ee273e Deal with & remove the XXX comments.
Change the markup to be more like the rest of the documentation.
2002-07-02 20:37:12 +00:00
Fred Drake ad74b7d4b3 Abstract the creation of signature lines for callable things; the new
\py@sigline macro will wrap the argument list so it will not extend into
the right margin.
Substantially based on a contribution from Dave Cole.
This addresses one of the comments in SF bug #574742.
2002-07-02 20:32:50 +00:00
Tim Peters a98011c388 Fix for SF bug #576327: zipfile when sizeof(long) == 8
binascii_crc32():  Make this return a signed 4-byte result across
platforms.  The other way to make this platform-independent would be to
make it return an unsigned unbounded int, but the evidence suggests
other code out there treats it like a signed 4-byte int (e.g., existing
code writing the result with struct.pack "l" format).

Bugfix candidate.
2002-07-02 20:20:08 +00:00
Jeremy Hylton fbd79944a8 Convert raise to call exception class. Add whitespace. 2002-07-02 20:19:08 +00:00
Jeremy Hylton 4e54730ed5 Repair badly formatted code. 2002-07-02 18:25:00 +00:00
Tim Peters 6fc13d9595 Finished transitioning to using gc_refs to track gc objects' states.
This was mostly a matter of adding comments and light code rearrangement.
Upon untracking, gc_next is still set to NULL.  It's a cheap way to
provoke memory faults if calling code is insane.  It's also used in some
way by the trashcan mechanism.
2002-07-02 18:12:35 +00:00
Fred Drake 8e8dc419d0 Remove bogus assignment to self.length in NamedNodeMap.__delitem__(). 2002-07-02 17:27:06 +00:00
Fred Drake abe7c1a4af Minor markup adjustments, consistency changes, and shorten a long
line.
2002-07-02 16:17:58 +00:00
Fred Drake 7c1bb9c528 Add refcount info for PyErr_SetFromWindowsErr() and
PyErr_SetFromWindowsErrWithFilename().
2002-07-02 16:16:18 +00:00
Thomas Heller 4f2722ac9b Docs for PyErr_SetFromWindowsErrWithFilename() and
PyErr_SetFromWindowsErr().
Fixes SF# 576016, with additional markup.
2002-07-02 15:47:03 +00:00
Fred Drake b28467b713 Do not depend on pymemcompat.h (was only used for PyXML); Martin likes
it all inline.
2002-07-02 15:44:36 +00:00
Jack Jansen 84262fb1f3 Mac OS X Jaguar (developer preview) seems to have a working getaddrinfo(). 2002-07-02 14:40:42 +00:00
Tim Peters ea405639bf Reserved another gc_refs value for untracked objects. Every live gc
object should now have a well-defined gc_refs value, with clear transitions
among gc_refs states.  As a result, none of the visit_XYZ traversal
callbacks need to check IS_TRACKED() anymore, and those tests were removed.
(They were already looking for objects with specific gc_refs states, and
the gc_refs state of an untracked object can no longer match any other
gc_refs state by accident.)
Added more asserts.
I expect that the gc_next == NULL indicator for an untracked object is
now redundant and can also be removed, but I ran out of time for this.
2002-07-02 00:52:30 +00:00
Fred Drake 7c75bf2090 Bring this back into sync with PyXML revision 1.58. 2002-07-01 14:02:31 +00:00
Tim Peters 19b74c7868 OK, I couldn't stand it <0.5 wink>: removed all uncertainty about what's
in gc_refs, even at the cost of putting back a test+branch in
visit_decref.

The good news:  since gc_refs became utterly tame then, it became
clear that another special value could be useful.  The move_roots() and
move_root_reachable() passes have now been replaced by a single
move_unreachable() pass.  Besides saving a pass over the generation, this
has a better effect:  most of the time everything turns out to be
reachable, so we were breaking the generation list apart and moving it
into into the reachable list, one element at a time.  Now the reachable
stuff stays in the generation list, and the unreachable stuff is moved
instead.  This isn't quite as good as it sounds, since sometimes we
guess wrongly that a thing is unreachable, and have to move it back again.

Still, overall, it yields a significant (but not dramatic) boost in
collection speed.
2002-07-01 03:52:19 +00:00
Tim Peters 93cd83e4ae visit_decref(): Two optimizations.
1. You're not supposed to call this with a NULL argument, although the
   docs could be clearer about that.  The other visit_XYZ() functions
   don't bother to check.  This doesn't either now, although it does
   assert non-NULL-ness now.

2. It doesn't matter whether the object is currently tracked, so don't
   bother checking that either (if it isn't currently tracked, it may
   have some nonsense value in gc_refs, but it doesn't hurt to
   decrement gibberish, and it's cheaper to do so than to make everyone
   test for trackedness).

It would be nice to get rid of the other tests on IS_TRACKED.  Perhaps
trackedness should not be a matter of not being in any gc list, but
should be a matter of being in a new "untracked" gc list.  This list
simply wouldn't be involved in the collection mechanism.  A newly
created object would be put in the untracked list.  Tracking would
simply unlink it and move it into the gen0 list.  Untracking would do
the reverse.  No test+branch needed then.  visit_move() may be vulnerable
then, though, and I don't know how this would work with the trashcan.
2002-06-30 21:31:03 +00:00