summaryrefslogtreecommitdiffstats
path: root/Objects
Commit message (Collapse)AuthorAgeFilesLines
* SF patch #664192 bug #661913: inconsistent error messages between stringRaymond Hettinger2003-01-151-2/+2
| | | | | | and unicode Patch by Christopher Blunck.
* Fix SF bug #667147, Segmentation fault printing str subclassNeal Norwitz2003-01-131-3/+16
| | | | | | | Fix infinite recursion which occurred when printing an object whose __str__() returned self. Will backport
* Fix charmapencode_lookup(), so that a None value in the mappingWalter Dörwald2003-01-081-0/+2
| | | | | is treated as "character maps to <undefined>" and not as "character mapping must return integer, None or str".
* Remove variable owned from PyUnicode_FromEncodedObject, which is unusedWalter Dörwald2003-01-081-7/+0
| | | | (except for Py_DECREF calls) since the introduction of __unicode__.
* Fix for SF bug #642358: only provide a new with a __dict__ orGuido van Rossum2003-01-071-4/+24
| | | | | __weaklist__ descriptor if we added __dict__ or __weaklist__, respectively. With unit test.
* Add a refinement to SLOT1BINFULL() that fixes the problem reported inGuido van Rossum2003-01-061-1/+36
| | | | | SF bug #623669: only try (e.g.) __rdiv__ before __div__ if the right class actually overrides it.
* GvR's idea to use memset() for the most common special case of repeatingRaymond Hettinger2003-01-061-1/+5
| | | | | a single character. Shaves another 10% off the running time by avoiding the lg2(N) loops and cache effects for the other cases.
* Optimize string_repeat.Raymond Hettinger2003-01-061-2/+11
| | | | | | | | | | | Christian Tismer pointed out the high cost of the loop overhead and function call overhead for 'c' * n where n is large. Accordingly, the new code only makes lg2(n) loops. Interestingly, 'c' * 1000 * 1000 ran a bit faster with old code. At some point, the loop and function call overhead became cheaper than invalidating the cache with lengthy memcpys. But for more typical sizes of n, the new code runs much faster and for larger values of n it runs only a bit slower.
* PyCFunction_Call(): Combined two switch cases w/ identical bodies.Tim Peters2003-01-051-4/+2
|
* SF Patch #661440: Refactor and streamline PyCFunction_CallRaymond Hettinger2003-01-041-31/+41
| | | | | | | | | | | | | | Refactor code in PyCFunction_Call giving a modest (tiny) speed boost, a slight improvement in semantics (now detects invalid flag combinations), and (arguably) improved clarity (making it blindingly clear which flag combinations are allowed). All this comes at a cost of a few lines of code duplication. * Folded test for METH_KEYWORDS into the switch/case. * Deferred testing for an empty dictionary until when and where needed. * Make a similar deferral for filling the "size" variable. * Inverted the dictionary test so that the common case falls though instead of making a jump.
* Grammatical fix in comment.Greg Ward2003-01-031-1/+1
|
* Allow PyFile_GetLine() to return Unicode objects. Fixes #660165.Martin v. Löwis2003-01-031-1/+24
|
* Allow list sort's comparison function to explicitly be None. See SF patchSkip Montanaro2003-01-021-1/+4
| | | | 661092.
* Merge to trunk from release branch:Guido van Rossum2002-12-311-0/+1
| | | | Plug the leak that Tim just reported.
* Fix an out-of-bound index in pmerge() discovered by Zooko (SF bugGuido van Rossum2002-12-311-1/+2
| | | | | | | 645404). I'm not 100% sure this is the right fix, so I'll keep the bug report open for Samuele, but this fixes the index error and passes the test suite (and I can't see why it *shouldn't* be the right fix :-).
* Since the *_Init() are private, prefix with _, suggested by SkipNeal Norwitz2002-12-312-2/+2
|
* SF #561244, Micro optimizationsNeal Norwitz2002-12-302-19/+36
| | | | | | Initialize the small integers and __builtins__ in startup. This removes some if conditions. Change XDECREF to DECREF for values which shouldn't be NULL.
* Consolidate the int and long sequence repeat code. Before the change,Neil Schemenauer2002-12-302-65/+0
| | | | integers checked for integer overflow but longs did not.
* Always try nb_* slots before trying sq_concat, sq_inplace_concat, sq_repeat,Neil Schemenauer2002-12-301-50/+128
| | | | | | | andsq_inplace_repeat. This fixes a number of corner case bugs (see #624807). Consolidate the int and long sequence repeat code. Before the change, integers checked for integer overflow but longs did not.
* Patch for bug #659709: bogus computation of float lengthMarc-André Lemburg2002-12-292-16/+37
| | | | | Python 2.2.x backport candidate. (This bug has been around since Python 1.6.)
* SF patch #659536: Use PyArg_UnpackTuple where possible.Raymond Hettinger2002-12-298-12/+12
| | | | | | | Obtain cleaner coding and a system wide performance boost by using the fast, pre-parsed PyArg_Unpack function instead of PyArg_ParseTuple function which is driven by a format string.
* SF Bug 645777: list.extend() works with any iterable and is no longerRaymond Hettinger2002-12-291-1/+1
| | | | experimental.
* Fix bug introduced by SF patch #643835, Set Next Statement for Python debuggersNeal Norwitz2002-12-191-4/+12
| | | | | | blockstack_top could be 0 when blockstack[blockstack_top-1] was referenced (ie blockstack[-1]) which crashed on hpux. Patch & fix by Richie Hindle
* Undefine MIN and MAX before definingNeal Norwitz2002-12-181-0/+2
| | | | Some systems (HPUX at least) already define MIN/MAX for us
* SF # 654974, fix unchecked return values in structseqNeal Norwitz2002-12-181-2/+6
| | | | | | | Check return values after memory allocation. Also use Py_True instead of PyInt_FromLong(1) for bool value. Backport candidate.
* * Objects/fileobject.cGustavo Niemeyer2002-12-171-1/+1
| | | | | (file_read): Replaced assertion with mixed sign operation by a simple comment (thank you Raymond). The algorithm is clear enough in that point.
* This is Richie Hindle's patchMichael W. Hudson2002-12-171-1/+259
| | | | | | | | [ 643835 ] Set Next Statement for Python debuggers with a few tweaks by me: adding an unsigned or two, mentioning that not all jumps are allowed in the doc for pdb, adding a NEWS item and a note to whatsnew, and AuCTeX doing something cosmetic to libpdb.tex.
* Fixed bugGustavo Niemeyer2002-12-161-3/+30
| | | | | | | | | | | | | | | | | [#521782] unreliable file.read() error handling * Objects/fileobject.c (file_read): Clear errors before leaving the loop in all situations, and also check if some data was read before exiting the loop with an EWOULDBLOCK exception. * Doc/lib/libstdtypes.tex * Objects/fileobject.c Document that sometimes a read() operation can return less data than what the user asked, if running in non-blocking mode. * Misc/NEWS Document the fix.
* Punctuation fix.Raymond Hettinger2002-12-141-2/+2
|
* Tighten the tests for assignment to __bases__: disallow empty tuple.Guido van Rossum2002-12-131-0/+6
|
* Patch #650653: Raise always value error if the table is not 256 bytes long.Martin v. Löwis2002-12-121-6/+6
|
* Change issubclass() so that recursive tuples (directly or indirectlyWalter Dörwald2002-12-122-5/+6
| | | | | | containing class objects) are allowed as the second argument. This makes issubclass() more similar to isinstance() where recursive tuples are allowed too.
* Enhance issubclass() and PyObject_IsSubclass() so that a tuple isWalter Dörwald2002-12-122-28/+49
| | | | | | | | | | | supported as the second argument. This has the same meaning as for isinstance(), i.e. issubclass(X, (A, B)) is equivalent to issubclass(X, A) or issubclass(X, B). Compared to isinstance(), this patch does not search the tuple recursively for classes, i.e. any entry in the tuple that is not a class, will result in a TypeError. This closes SF patch #649608.
* Constify char* API. Fixes #651363. 2.2 candidate.Martin v. Löwis2002-12-111-3/+3
|
* Patch #650834: Document 'U' in file mode, remove stale variables.Martin v. Löwis2002-12-111-5/+1
|
* Update comments about the performance of xrange().Raymond Hettinger2002-12-111-2/+2
|
* SF 548651: Fix the METH_CLASS implementation.Tim Peters2002-12-093-4/+75
| | | | | | | Most of these patches are from Thomas Heller, with long lines folded by Tim. The change to test_descr.py is from Guido. See the bug report. Not a bugfix candidate -- METH_CLASS is new in 2.3.
* slot_nb_nonzero(): Another leak uncovered by the sandbox datetimeTim Peters2002-12-071-28/+27
| | | | | | | tests. I found the logic too confusing to follow here, so rewrote more than was likely absolutely necessary. Bugfix candidate.
* Fix typo in abstract.c which caused __rpow__ to not be invoked.Raymond Hettinger2002-12-071-1/+1
| | | | | Added related testcase. Closes SF bug #643260.
* Remove assumption that cls is a subclass of dict.Raymond Hettinger2002-12-071-7/+1
| | | | Simplifies the code and gets Just van Rossum's example to work.
* slot_tp_hash(): In the normal path, this leaked a reference to theTim Peters2002-12-061-3/+3
| | | | | | integer hash object returned by __hash__(). This accounts for some of the "mystery leaks" in the sandbox datetime tests, but probably not all of them.
* Patch #614055: Support OpenVMS.Martin v. Löwis2002-12-061-1/+5
|
* The final tweaks before closingMichael W. Hudson2002-12-051-20/+23
| | | | | | [ 633152 ] list slice ass ignores subtypes of list Allow arbitrary sequences on the RHS of extended slices.
* Replace BadInternalCall with TypeError. Add a test case. Fix whitespace.Raymond Hettinger2002-12-041-2/+3
| | | | | | | Just van Rossum showed a weird, but clever way for pure python code to trigger the BadInternalCall. The C code had assumed that calling a class constructor would return an instance of that class; however, classes that abuse __new__ can invalidate that assumption.
* Add missing decrefNeal Norwitz2002-11-271-0/+1
|
* Nudge getting __module__ and __name__ for new-style classes so thatMichael W. Hudson2002-11-271-17/+24
| | | | | | | the results of *setting* __name__ are not so surprising. If people can suggest more tests, that'd be grand, or is what's there sufficient?
* I don't know why staring at the email to python-checkins made meMichael W. Hudson2002-11-271-9/+14
| | | | | | | see problems with my code that I didn't see before the checkin, but: When a subtype .mro() fails, we need to reset the type whose __bases__ are being changed, too. Fix + test.
* Readjustments to the way we cope with exceptions from subclasses'Michael W. Hudson2002-11-271-10/+32
| | | | | | mro() methods. Now any exception aborts the whole __bases__ change. And more tests.
* I had the inheritance cycle stuff backwards. Oops!Michael W. Hudson2002-11-271-4/+6
|
* SF Patch 643443. Added dict.fromkeys(iterable, value=None), a classRaymond Hettinger2002-11-271-0/+56
| | | | method for constructing new dictionaries from sequences of keys.