summaryrefslogtreecommitdiffstats
path: root/Objects
Commit message (Collapse)AuthorAgeFilesLines
* Squash compiler wng about signed/unsigned comparison mismatch.Tim Peters2003-01-311-1/+1
|
* Provide __module__ attributes for functions defined in C and Python.Jeremy Hylton2003-01-312-6/+68
| | | | | | | | | | | | | | __module__ is the string name of the module the function was defined in, just like __module__ of classes. In some cases, particularly for C functions, the __module__ may be None. Change PyCFunction_New() from a function to a macro, but keep an unused copy of the function around so that we don't change the binary API. Change pickle's save_global() to use whichmodule() if __module__ is None, but add the __module__ logic to whichmodule() since it might be used outside of pickle.
* Change the treatment of positions returned by PEP293Walter Dörwald2003-01-311-9/+17
| | | | | | | | | | | | | | | | error handers in the Unicode codecs: Negative positions are treated as being relative to the end of the input and out of bounds positions result in an IndexError. Also update the PEP and include an explanation of this in the documentation for codecs.register_error. Fixes a small bug in iconv_codecs: if the position from the callback is negative *add* it to the size instead of substracting it. From SF patch #677429.
* _PyLong_NumBits(): The definition of this was too specific to the quirkyTim Peters2003-01-311-8/+17
| | | | | | | | | needs of pickling longs. Backed off to a definition that's much easier to understand. The pickler will have to work a little harder, but other uses are more likely to be correct <0.5 wink>. _PyLong_Sign(): New teensy function to characterize a long, as to <0, ==0, or >0.
* Implement appropriate __getnewargs__ for all immutable subclassable builtinGuido van Rossum2003-01-297-4/+72
| | | | | | | | types. The special handling for these can now be removed from save_newobj(). Add some testing for this. Also add support for setting the 'fast' flag on the Python Pickler class, which suppresses use of the memo.
* Added new private API function _PyLong_NumBits. This will be used at theTim Peters2003-01-281-0/+35
| | | | | | | start for the C implemention of new pickle LONG1 and LONG4 opcodes (the linear-time way to pickle a long is to call _PyLong_AsByteArray, but the caller has no idea how big an array to allocate, and correct calculation is a bit subtle).
* Fix SF bug# 676155, RuntimeWarning with tp_compareNeal Norwitz2003-01-281-1/+4
| | | | Check return value of PyLong_AsDouble(), it can return an error.
* Recursive compare machinery: The code that intended to exempt tuplesTim Peters2003-01-201-9/+14
| | | | | | | | | | | | was broken because new-in-2.3 code added a tp_as_mapping slot to tuples. Repaired that. Added basic docs to check_recursion(). The code that intended to exempt tuples and strings was also broken here, and in 2.2: these should use PyXYZ_CheckExact(), not PyXYZ_Check() -- we can't know whether subclass instances are immutable. This part (and this part alone) is a bugfix candidate.
* SF # 669553, fix memory (ref) leaksNeal Norwitz2003-01-191-1/+8
| | | | Will backport.
* 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.