summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* Abstract the creation of signature lines for callable things; the newFred Drake2002-07-022-7/+20
| | | | | | | \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.
* Fix for SF bug #576327: zipfile when sizeof(long) == 8Tim Peters2002-07-021-1/+11
| | | | | | | | | | 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.
* Convert raise to call exception class. Add whitespace.Jeremy Hylton2002-07-021-1/+1
|
* Repair badly formatted code.Jeremy Hylton2002-07-021-19/+17
|
* Finished transitioning to using gc_refs to track gc objects' states.Tim Peters2002-07-022-42/+71
| | | | | | | 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.
* Remove bogus assignment to self.length in NamedNodeMap.__delitem__().Fred Drake2002-07-021-1/+0
|
* Minor markup adjustments, consistency changes, and shorten a longFred Drake2002-07-021-12/+13
| | | | line.
* Add refcount info for PyErr_SetFromWindowsErr() andFred Drake2002-07-021-0/+7
| | | | PyErr_SetFromWindowsErrWithFilename().
* Docs for PyErr_SetFromWindowsErrWithFilename() andThomas Heller2002-07-021-0/+23
| | | | | PyErr_SetFromWindowsErr(). Fixes SF# 576016, with additional markup.
* Do not depend on pymemcompat.h (was only used for PyXML); Martin likesFred Drake2002-07-021-4/+6
| | | | it all inline.
* Mac OS X Jaguar (developer preview) seems to have a working getaddrinfo().Jack Jansen2002-07-021-0/+5
|
* Reserved another gc_refs value for untracked objects. Every live gcTim Peters2002-07-022-8/+26
| | | | | | | | | | | | 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.
* Bring this back into sync with PyXML revision 1.58.Fred Drake2002-07-011-3/+10
|
* OK, I couldn't stand it <0.5 wink>: removed all uncertainty about what'sTim Peters2002-07-011-96/+163
| | | | | | | | | | | | | | | | | | | 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.
* visit_decref(): Two optimizations.Tim Peters2002-06-301-5/+3
| | | | | | | | | | | | | | | | | | | | | | 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.
* SF bug #574132: Major GC related performance regressionTim Peters2002-06-301-13/+43
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | "The regression" is actually due to that 2.2.1 had a bug that prevented the regression (which isn't a regression at all) from showing up. "The regression" is actually a glitch in cyclic gc that's been there forever. As the generation being collected is analyzed, objects that can't be collected (because, e.g., we find they're externally referenced, or are in an unreachable cycle but have a __del__ method) are moved out of the list of candidates. A tricksy scheme uses negative values of gc_refs to mark such objects as being moved. However, the exact negative value set at the start may become "more negative" over time for objects not in the generation being collected, and the scheme was checking for an exact match on the negative value originally assigned. As a result, objects in generations older than the one being collected could get scanned too, and yanked back into a younger generation. Doing so doesn't lead to an error, but doesn't do any good, and can burn an unbounded amount of time doing useless work. A test case is simple (thanks to Kevin Jacobs for finding it!): x = [] for i in xrange(200000): x.append((1,)) Without the patch, this ends up scanning all of x on every gen0 collection, scans all of x twice on every gen1 collection, and x gets yanked back into gen1 on every gen0 collection. With the patch, once x gets to gen2, it's never scanned again until another gen2 collection, and stays in gen2. Bugfix candidate, although the code has changed enough that I think I'll need to port it by hand. 2.2.1 also has a different bug that causes bound method objects not to get tracked at all (so the test case doesn't burn absurd amounts of time in 2.2.1, but *should* <wink>).
* Patch #569753: Remove support for WIN16.Martin v. Löwis2002-06-3018-241/+102
| | | | Rename all occurrences of MS_WIN32 to MS_WINDOWS.
* Bump required PyXML version to 0.6.5.Martin v. Löwis2002-06-301-1/+1
|
* Implement the encoding argument for toxml and toprettyxml.Martin v. Löwis2002-06-305-9/+68
| | | | Document toprettyxml.
* Merge from PyXML:Martin v. Löwis2002-06-301-2/+26
| | | | | | [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.
* Add xml namespace initially (PyXML 1.19).Martin v. Löwis2002-06-301-1/+2
|
* Fix spacing.Martin v. Löwis2002-06-301-1/+1
|
* Merge changes from PyXML:Martin v. Löwis2002-06-301-13/+76
| | | | | | | | | | | | | | | | | | | | [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.
* Define PyDoc_STRVAR if it is not available (PyXML 1.54).Martin v. Löwis2002-06-301-63/+11
| | | | Remove support for Python 1.5 (PyXML 1.55).
* Undo usage of PyOS_snprintf (rev. 1.51 of PyXML).Martin v. Löwis2002-06-301-1/+3
|
* Fixed bug 574978 shutil example out of sync with source codeRaymond Hettinger2002-06-301-2/+1
|
* Fix bug 575221 referred to dictionary type instead of dict.Raymond Hettinger2002-06-301-1/+1
|
* Code modernization. Replace v=s[i]; del s[i] with single lookup v=s.pop(i)Raymond Hettinger2002-06-3011-42/+19
|
* Clarify the version information for the unicode() built-in.Fred Drake2002-06-291-6/+9
| | | | Closes SF bug #575272.
* Another test of long headers.Barry Warsaw2002-06-292-0/+19
|
* Oleg Broytmann's support for RFC 2231 encoded parameters, SF patch #549133Barry Warsaw2002-06-292-1/+34
| | | | New test cases.
* Oleg Broytmann's support for RFC 2231 encoded parameters, SF patch #549133Barry Warsaw2002-06-291-0/+57
| | | | | | | | | Specifically, decode_rfc2231(), encode_rfc2231(): Functions to encode and decode RFC 2231 style parameters. decode_params(): Function to decode a list of parameters.
* Oleg Broytmann's support for RFC 2231 encoded parameters, SF patch #549133Barry Warsaw2002-06-291-7/+27
| | | | | | | | | | | | | | | | | 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.
* test_multilingual(): Test for Header.__unicode__().Barry Warsaw2002-06-291-0/+22
|
* __unicode__(): Patch # 541263 by Mikhail Zabaluev, implementationBarry Warsaw2002-06-291-0/+6
| | | | modified by Barry.
* Add documentation for new textwrap module.Greg Ward2002-06-293-0/+143
|
* Typo fix.Greg Ward2002-06-291-1/+1
|
* Track change of begin() to _begin().Jeremy Hylton2002-06-281-2/+2
|
* Lots of new and updated tests to check for proper ascii headerBarry Warsaw2002-06-282-42/+187
| | | | | | | 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!
* _max_append(): When adding the string `s' to its own line, it shouldBarry Warsaw2002-06-281-2/+2
| | | | | be lstrip'd so that old continuation whitespace is replaced by that specified in Header's continuation_ws parameter.
* Teach this class about "highest-level syntactic breaks" but only forBarry Warsaw2002-06-281-58/+151
| | | | | | | | | | | | | | | | | | | | | | | 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.
* _split_header(): The code here was terminally broken because it didn'tBarry Warsaw2002-06-281-53/+11
| | | | | | | | 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.
* Simplify HTTPSConnection constructor.Jeremy Hylton2002-06-281-21/+7
| | | | See discussion in SF bug 458463.
* Close SF patch 523944: importing modules with foreign newlines.Jeremy Hylton2002-06-281-1/+1
| | | | | | 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.
* Added character data buffering to pyexpat parser objects.Fred Drake2002-06-282-21/+251
| | | | | | | | | 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.
* Add Bob Kline of HTTP 100 fame.Jeremy Hylton2002-06-281-0/+1
|
* Fixes for two separate HTTP/1.1 bugs: 100 responses and HTTPS connections.Jeremy Hylton2002-06-281-32/+102
| | | | | | | | | | | | | | | | | | | | | | | 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.
* pyexpat code cleanup and minor refactorings:Fred Drake2002-06-281-221/+176
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The handlers array on each parser now has the invariant that None will never be set as a handler; it will always be NULL or a Python-level value passed in for the specific handler. have_handler(): Return true if there is a Python handler for a particular event. get_handler_name(): Return a string object giving the name of a particular handler. This caches the string object so it doesn't need to be created more than once. get_parse_result(): Helper to allow the Parse() and ParseFile() methods to share the same logic for determining the return value or exception state. PyUnknownEncodingHandler(), PyModule_AddIntConstant(): Made these helpers static. (The later is only defined for older versions of Python.) pyxml_UpdatePairedHandlers(), pyxml_SetStartElementHandler(), pyxml_SetEndElementHandler(), pyxml_SetStartNamespaceDeclHandler(), pyxml_SetEndNamespaceDeclHandler(), pyxml_SetStartCdataSection(), pyxml_SetEndCdataSection(), pyxml_SetStartDoctypeDeclHandler(), pyxml_SetEndDoctypeDeclHandler(): Removed. These are no longer needed with Expat 1.95.x. handler_info: Use the setter functions provided by Expat 1.95.x instead of the pyxml_Set*Handler() functions which have been removed. Minor code formatting changes for consistency. Trailing whitespace removed.
* Fix small bug. The count of objects in all generations younger then theNeil Schemenauer2002-06-281-1/+1
| | | | collected one should be zeroed.
* Patch 574531/Bug 574570 - allow freeze on windows to use the _winregMark Hammond2002-06-281-1/+5
| | | | extension.