summaryrefslogtreecommitdiffstats
path: root/Lib
Commit message (Collapse)AuthorAgeFilesLines
* Whitespace normalization.Tim Peters2001-10-0418-65/+65
|
* SF bug [#467331] ClassType.__doc__ always None.Tim Peters2001-10-042-6/+35
| | | | | | | | | For a dynamically constructed type object, fill in the tp_doc slot with a copy of the argument dict's "__doc__" value, provided the latter exists and is a string. NOTE: I don't know what to do if it's a Unicode string, so in that case tp_doc is left NULL (which shows up as Py_None if you do Class.__doc__). Note that tp_doc holds a char*, not a general PyObject*.
* Hopefully fix the profiler right. Add a test suite that checks thatGuido van Rossum2001-10-043-18/+136
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | it deals correctly with some anomalous cases; according to this test suite I've fixed it right. The anomalous cases had to do with 'exception' events: these aren't generated when they would be most helpful, and the profiler has to work hard to recover the right information. The problems occur when C code (such as hasattr(), which is used as the example here) calls back into Python code and clears an exception raised by that Python code. Consider this example: def foo(): hasattr(obj, "bar") Where obj is an instance from a class like this: class C: def __getattr__(self, name): raise AttributeError The profiler sees the following sequence of events: call (foo) call (__getattr__) exception (in __getattr__) return (from foo) Previously, the profiler would assume the return event returned from __getattr__. An if statement checking for this condition and raising an exception was commented out... This version does the right thing.
* Add some more test cases to be sure we do the right thing in various cases.Fred Drake2001-10-031-0/+117
|
* Undo previous patch; it did not quite work out.Fred Drake2001-10-031-1/+1
|
* Set .addr in a few more places (patch approved by Sam Rushing)Andrew M. Kuchling2001-10-031-0/+2
|
* dynamics(): add a dummy __getattr__ method to the C class so that theGuido van Rossum2001-10-031-0/+5
| | | | | | test for modifying __getattr__ works, now that slot_tp_getattr_hook zaps the slot if there's no hook. Added an XXX comment with a ref back to slot_tp_getattr_hook.
* remove empty __del__ method from BaseRequestHandler to avoid cyclic garbageSkip Montanaro2001-10-031-3/+0
| | | | loss for no reason.
* Made the classmethod docstring test a bit less trivial.Tim Peters2001-10-031-3/+3
|
* SF bug [#467336] doctest failures w/ new-style classes.Tim Peters2001-10-034-8/+167
| | | | | | | | | | Taught doctest about static methods, class methods, and property docstrings in new-style classes. As for inspect.py/pydoc.py before it, the new stuff needed didn't really fit into the old architecture (but was less of a strain to force-fit here). New-style class docstrings still aren't found, but that's the subject of a different bug and I want to fix that right instead of hacking around it in doctest.
* SF patch [#466616] Exclude imported items from doctest.Tim Peters2001-10-021-7/+13
| | | | | Another installment; the new functionality wasn't actually enabled in normal use, only in the strained use checked by the test case.
* Add Garbage Collection support to new-style classes (not yet to theirGuido van Rossum2001-10-021-7/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | instances). Also added GC support to various auxiliary types: super, property, descriptors, wrappers, dictproxy. (Only type objects have a tp_clear field; the other types are.) One change was necessary to the GC infrastructure. We have statically allocated type objects that don't have a GC header (and can't easily be given one) and heap-allocated type objects that do have a GC header. Giving these different metatypes would be really ugly: I tried, and I had to modify pickle.py, cPickle.c, copy.py, add a new invent a new name for the new metatype and make it a built-in, change affected tests... In short, a mess. So instead, we add a new type slot tp_is_gc, which is a simple Boolean function that determines whether a particular instance has GC headers or not. This slot is only relevant for types that have the (new) GC flag bit set. If the tp_is_gc slot is NULL (by far the most common case), all instances of the type are deemed to have GC headers. This slot is called by the PyObject_IS_GC() macro (which is only used twice, both times in gcmodule.c). I also changed the extern declarations for a bunch of GC-related functions (_PyObject_GC_Del etc.): these always exist but objimpl.h only declared them when WITH_CYCLE_GC was defined, but I needed to be able to reference them without #ifdefs. (When WITH_CYCLE_GC is not defined, they do the same as their non-GC counterparts anyway.)
* pickles():Guido van Rossum2001-10-021-18/+22
| | | | | | | | - The test for deepcopy() in pickles() was indented wrongly, so it got run twice (one for binary pickle mode, one for text pickle mode; but the test doesn't depend on the pickle mode). - In verbose mode, show which subtest (pickle/cPickle/deepcopy, text/bin).
* The error reporting here was a bit sparse. In verbose mode, the codeGuido van Rossum2001-10-021-30/+24
| | | | | | | | | | in run_test() referenced two non-existent variables, and in non-verbose mode, the tests didn't report the actual number, when it differed from the expected number. Fixed this. Also added an extra call to gc.collect() at the start of test_all(). This will be needed when I check in the changes to add GC to new-style classes.
* Under certain conditions (sometimes triggered by the test suite),Guido van Rossum2001-10-021-0/+2
| | | | | "from xml.parsers import expat" succeeds but the imported expat module is an empty shell. Make sure we don't be fooled by that.
* Correct the URL for the license (only used when the LICENSE[.txt] fileGuido van Rossum2001-10-021-1/+1
| | | | | is not found). Being fancy: insert the first 3 characters of sys.version in the URL.
* SF patch [#466616] Exclude imported items from doctest,Tim Peters2001-10-022-53/+73
| | | | | | | from Tim Hochberg. Also mucho fiddling to change the way doctest determines whether a thing is a function, module or class. Under 2.2, this really requires the functions in inspect.py (e.g., types.ClassType is close to meaningless now, if not outright misleading).
* restored 1.5.2 compatibilityFredrik Lundh2001-10-011-46/+39
| | | | | added local escape method (made the dumps method some 50-80% faster) minor tweaks to the unmarshalling code
* approximately double dump performance by moving import of cgi.escape back toSkip Montanaro2001-10-011-6/+4
| | | | top level.
* simple dumps/loads test case for xmlrpclibSkip Montanaro2001-10-011-0/+23
|
* Undo last checkin, since it duplicated the code.Martin v. Löwis2001-10-011-25/+0
|
* SF patch #462628 (Travers Naran) NNTPLib supports saving BODY to a file.Guido van Rossum2001-10-011-19/+37
| | | | | | | | | | I modified nntplib so the body method can accept an optional second parameter pointing to a filehandle or filename (string). This way, really long body articles can be stored to disk instead of kept in memory. The way I made the modification should make it easy to extend this functionality to other extended return methods.
* Patch #426880: Implement Listbox itemcget and itemconfigure.Martin v. Löwis2001-10-011-0/+25
|
* Patch #462190, patch #464070: Support quoted printable in the binascii module.Martin v. Löwis2001-09-302-11/+57
| | | | Decode and encode underscores for header style encoding. Fixes bug #463996.
* Properly detect recursive structures. Adopted from patch #465298.Martin v. Löwis2001-09-301-0/+6
|
* For Python 2.2, do not use __getattr__(), only use computed properties.Fred Drake2001-09-291-31/+61
| | | | | | This is probably a little bit faster, but mostly is just cleaner code. The old-style support is still used for Python versions < 2.2 so this source file can be shared with PyXML.
* _dispatch(): Do no re-define the resolve_dotted_atttribute() functionFred Drake2001-09-291-21/+17
| | | | | every time this gets called; move it out as a global helper function. Simplify the call to the _dispatch() method of the registered instance.
* Add a few ``__dynamic__ = 0'' lines in classes that need to preserveGuido van Rossum2001-09-291-3/+7
| | | | | | | | | | | | staticness when __dynamic__ = 1 becomes the default: - Some classes which are used to test the difference between static and dynamic. - Subclasses of complex: complex uses old-style numbers and the slot wrappers used by dynamic classes only support new-style numbers. (Ideally, the complex type should be fixed, but that looks like a labor-intensive job.)
* It's a fact: for binary operators, *under certain circumstances*,Guido van Rossum2001-09-281-1/+36
| | | | | | | | | | | | | __rop__ now takes precendence over __op__. Those circumstances are: - Both arguments are new-style classes - Both arguments are new-style numbers - Their implementation slots for tp_op differ - Their types differ - The right argument's type is a subtype of the left argument's type Also did this for the ternary operator (pow) -- only the binary case is dealt with properly though, since __rpow__ is not supported anyway.
* Update the xml.dom.minidom tests to cover the DOM-compliant parts of theFred Drake2001-09-282-2/+31
| | | | NodeList interface.
* Tighten up the new NodeList implementation.Fred Drake2001-09-281-7/+7
| | | | | Clean up a little; do not create an alias that is only used once, or store attributes with constant values in an instance.
* Remove an infelicitous space.Fred Drake2001-09-281-1/+1
|
* regrtest's -g option stopped working, during the changes to improveTim Peters2001-09-281-1/+1
| | | | | error-reporting for the classic compare-expected-output tests. Curiously, the bug consisted of not simplifying the logic enough!
* Reflect recent refinements of the regression testing framework.Fred Drake2001-09-281-9/+33
|
* Clean up circular references in the Weak*Dictionary classes; this avoidsFred Drake2001-09-281-11/+14
| | | | | | | | depending on the cycle detector code in the library implementation. This is a *slightly* different patch than SF patch #417795, but takes the same approach. (This version avoids calling the __len__() method of the dict in the remove() functions.) This closes SF patch #417795.
* Add complex to the dispatch tables, to avoid going through the wholeGuido van Rossum2001-09-281-0/+8
| | | | rigmarole of __reduce__.
* Changes to copy() and deepcopy() in copy.py to support __reduce__ as aGuido van Rossum2001-09-283-9/+91
| | | | | | | | | | fallback for objects that are neither supported by our dispatch table nor have a __copy__ or __deepcopy__ method. Changes to _reduce() in copy_reg.py to support reducing objects that don't have a __dict__ -- copy.copy(complex()) now invokes _reduce(). Add tests for copy.copy() and copy.deepcopy() to test_regrtest.py.
* For Python 2.2 and newer, actually support the full NodeList interface byFred Drake2001-09-281-2/+19
| | | | subclassing list to add the length and item() attributes.
* Change the sense of a test in how the profiler interprets exception events.Fred Drake2001-09-271-1/+1
| | | | | This should fix a bug in how time is allocated during exception propogation (esp. in the presence of finally clauses).
* Fix comment typoAndrew M. Kuchling2001-09-271-1/+1
|
* docroutine() (both instances): Docstrings for class methods weren'tTim Peters2001-09-271-2/+0
| | | | | | | | | | | | | | | | getting displayed, due to a special case here whose purpose I didn't understand. So just disabled the doc suppression here. Another special case here skips the docs when picking apart a method and finding that the im_func is also in the class __dict__ under the same name. That one I understood. It has a curious consequence, though, wrt inherited properties: a static class copies inherited stuff into the inheriting class's dict, and that affects whether or not this special case triggers. The upshoot is that pydoc doesn't show the function docstrings of getter/setter/deleter functions of inherited properties in the property section when the class is static, but does when the class is dynamic (bring up Lib/test/pydocfodder.py under GUI pydoc to see this).
* List class attrs in MRO order of defining class instead of by alphabeticTim Peters2001-09-271-23/+12
| | | | order of defining class's name.
* Removed no-longer-true comment about pydoc working under all versions ofTim Peters2001-09-261-4/+0
| | | | | Python since 1.5 (virtually everything I changed over the last week relies on "modern" features, particularly nested scopes).
* Display a class's method resolution order, if it's non-trivial. "Trivial"Tim Peters2001-09-261-1/+22
| | | | | here means it has no more than one base class to rummage through (in which cases there's no potential confusion about resolution order).
* More test cases, including something that simulates what the profilerFred Drake2001-09-261-5/+66
| | | | probably *should* be doing.
* A file just to look at (using pydoc).Tim Peters2001-09-261-0/+297
|
* Add tests for new PyErr_NormalizeException() behaviorJeremy Hylton2001-09-261-0/+35
| | | | | | | | | | | | Add raise_exception() to the _testcapi module. It isn't a test, but the C API exists only to support test_exceptions. raise_exception() takes two arguments -- an exception class and an integer specifying how many arguments it should be called with. test_exceptions uses BadException() to test the interpreter's behavior when there is a problem instantiating the exception. test_capi1() calls it with too many arguments. test_capi2() causes an exception to be raised in the Python code of the constructor.
* Don't export generators future infoJeremy Hylton2001-09-261-1/+1
|
* Test case for SF bugs #463359 and #462937, added to test_grammar for lack ofThomas Wouters2001-09-262-0/+28
| | | | | a better place. Excessively fragile code, but at least it breaks when something in this area changes!
* Update the tests for the current incarnation of the email package, andBarry Warsaw2001-09-261-105/+198
| | | | added some new tests of message/delivery-status content type messages.