summaryrefslogtreecommitdiffstats
path: root/Modules
Commit message (Collapse)AuthorAgeFilesLines
* Trashcan cleanup: Now that cyclic gc is always there, the trashcanTim Peters2002-07-071-0/+3
| | | | | | | | | | | | | | | | | | | 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.
* Removed WITH_CYCLE_GC #ifdef-ery. Holes:Tim Peters2002-07-072-25/+0
| | | | | | + I'm not sure what to do about configure.in. Left it alone. + Ditto pyexpat.c. Fred or Martin will know what to do.
* gc_list_move defined but not used.Michael W. Hudson2002-07-041-15/+0
|
* Another stab at SF 576327: zipfile when sizeof(long) == 8Tim Peters2002-07-021-100/+106
| | | | | | | | 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.
* visit_decref(): Added another assert.Tim Peters2002-07-021-0/+1
|
* 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.
* Repair badly formatted code.Jeremy Hylton2002-07-021-19/+17
|
* Finished transitioning to using gc_refs to track gc objects' states.Tim Peters2002-07-021-39/+66
| | | | | | | 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.
* 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-021-6/+16
| | | | | | | | | | | | 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-307-167/+66
| | | | Rename all occurrences of MS_WIN32 to MS_WINDOWS.
* 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
|
* Added character data buffering to pyexpat parser objects.Fred Drake2002-06-281-20/+157
| | | | | | | | | 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.
* 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.
* Integrate the changes from PyXML's version of pyexpat.c revisionsFred Drake2002-06-271-46/+109
| | | | 1.47, 1.48, 1.49 (name interning support).
* Undefine DPRINTF before defining it, there was a conflict with some otherJack Jansen2002-06-261-0/+1
| | | | definition.
* Undefine TRUE and FALSE before redefining them.Jack Jansen2002-06-261-0/+2
|
* Clean up docstrings:Fred Drake2002-06-201-110/+105
| | | | | | | - Include a blank line between the signature line and the description (Guido sez). - Don't include "-> None" for API functions that always return None because they don't have a meaningful return value.
* Fix the bug described inMichael W. Hudson2002-06-191-1/+174
| | | | | | | | | 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.
* Corect speling and add \n\ to line ends in new docstring for access().Guido van Rossum2002-06-181-5/+5
|
* Clarified documentation for os.access().Fred Drake2002-06-181-1/+5
| | | | | Patch contributed by Sean Reifschneider. Closes SF patch #570618.
* Removed newmodule.c from the project, and removed references to it fromTim Peters2002-06-161-215/+0
| | | | the Windowish builds.
* SF patch 568629 by Oren Tirosh: types made callable.Guido van Rossum2002-06-141-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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]
* This introduces stricter library/header file checking for the Berkeley DBSkip Montanaro2002-06-141-3/+0
| | | | | | | | | library. Since multiple versions can be installed simultaneously, it's crucial that you only select libraries and header files which are compatible with each other. Version checking is done from highest version to lowest. Building using version 1 of Berkeley DB is disabled by default because of the hash file bugs people keep rediscovering. It can be enabled by uncommenting a few lines in setup.py. Closes patch 553108.
* SF # 533070 Silence AIX C Compiler WarningsNeal Norwitz2002-06-131-1/+1
| | | | Warning caused by using &func. & is not necessary.
* Use new PyDoc_STRVAR macroNeal Norwitz2002-06-131-2/+2
|
* SF #561244 Micro optimizationsNeal Norwitz2002-06-131-4/+1
| | | | Convert loops to memset()s.
* Patch #568235: Add posix.setpgid.Martin v. Löwis2002-06-131-0/+22
|
* Patch #568124: Add doc string macros.Martin v. Löwis2002-06-1339-1110/+1029
|
* Fix non-blocking connect() for Windows. Refactored the codeGuido van Rossum2002-06-131-27/+40
| | | | | | | | | | | 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).
* Major overhaul of timeout sockets:Guido van Rossum2002-06-132-222/+60
| | | | | | | | | | | | | | | | | | | | - 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.
* _Py prefix is verboten for static entry pointsAndrew MacIntyre2002-06-131-4/+4
|
* work around name clash with OS/2 TCPIP routine sock_init()Andrew MacIntyre2002-06-131-2/+2
|
* patch #562492 - prevent duplicate lines in historySkip Montanaro2002-06-111-2/+19
| | | | also call using_history() to properly initialize history variables
* Patch #488073: AtheOS port.Martin v. Löwis2002-06-111-1/+3
|
* Don't accept null bytes in the key.Guido van Rossum2002-06-101-2/+1
|
* SF bug 563750 (Alex Martelli): posix_tmpfile():Guido van Rossum2002-06-101-1/+1
| | | | | | | The file returned by tmpfile() has mode w+b, so use that in the call to PyFile_FromFile(). Bugfix candidate.
* Move the conex_finally label up, so that the errno value is alwaysGuido van Rossum2002-06-071-1/+1
| | | | returned.
* I decided to change the interaction between setblocking() andGuido van Rossum2002-06-071-5/+2
| | | | | | | | | | settimeout(). Already, settimeout() canceled non-blocking mode; now, setblocking() also cancels the timeout. This is easier to document. (XXX should settimeout(0) be an alias for setblocking(0)? They seem to have roughly the same effect. Also, I'm not sure that the code in connect() and accept() is correct in all cases. We'll sort this out soon enough.)
* Major cleanup. Renamed static methods to avoid Py prefix. Other miscGuido van Rossum2002-06-071-296/+290
| | | | cleanup as well, e.g. renamed NTinit to os_init.
* Repair a comment.Guido van Rossum2002-06-071-1/+1
|
* Whitespace normalization, folding long lines, uniform commentGuido van Rossum2002-06-071-224/+229
| | | | delimiters. Also repaired some docstrings and comments.
* Correct several blunders in the timeout code, mostly my own fault (forGuido van Rossum2002-06-071-14/+12
| | | | | | | | | | | | | | | | | | | | | not testing it -- apparently test_timeout.py doesn't test anything useful): In internal_select(): - The tv_usec part of the timeout for select() was calculated wrong. - The first argument to select() was one too low. - The sense of the direction argument to internal_select() was inverted. In PySocketSock_settimeout(): - The calls to internal_setblocking() were swapped. Also, repaired some comments and fixed the test for the return value of internal_select() in sendall -- this was in the original patch.