summaryrefslogtreecommitdiffstats
path: root/Objects/abstract.c
Commit message (Collapse)AuthorAgeFilesLines
* Fix coding style guide bug.Brett Cannon2006-06-061-1/+2
|
* C++ compilation cleanup: Migrate declaration ofSkip Montanaro2006-04-181-7/+0
| | | | | _PyObject_Call(Function|Method)_SizeT into Include/abstract.h. This gets them under the umbrella of the extern "C" { ... } block in that file.
* Make Py_BuildValue, PyObject_CallFunction andMartin v. Löwis2006-04-141-28/+90
| | | | PyObject_CallMethod aware of PY_SSIZE_T_CLEAN.
* Minor bugs in the __index__ code (PEP 357), with tests.Armin Rigo2006-03-301-2/+3
|
* Stop duplicating code and handle slice indices consistently and correctlyNeal Norwitz2006-03-231-20/+2
| | | | wrt to ssize_t.
* Update function name to reflect params and stop casting to long to avoid ↵Neal Norwitz2006-03-201-5/+5
| | | | losing data
* Checking in the code for PEP 357.Guido van Rossum2006-03-071-44/+32
| | | | | | This was mostly written by Travis Oliphant. I've inspected it all; Neal Norwitz and MvL have also looked at it (in an earlier incarnation).
* Change some sequnce APIs to use Py_ssize_t.Neal Norwitz2006-03-041-5/+9
|
* Revert backwards-incompatible const changes.Martin v. Löwis2006-02-271-1/+1
|
* Use Py_ssize_t for counts and sizes.Martin v. Löwis2006-02-161-2/+2
| | | | Convert Py_ssize_t using PyInt_FromSsize_t
* Merge ssize_t branch.Martin v. Löwis2006-02-151-43/+43
|
* Renamed _length_cue() to __length_hint__(). See:Armin Rigo2006-02-111-3/+3
| | | | http://mail.python.org/pipermail/python-dev/2006-February/060524.html
* Remove some shadowed variablesNeal Norwitz2006-01-081-1/+1
|
* SF patch #1390657:Armin Rigo2005-12-291-6/+45
| | | | | | | | | | | | | | | | | * set sq_repeat and sq_concat to NULL for user-defined new-style classes, as a way to fix a number of related problems. See test_descr.notimplemented()). One of these problems was fixed in r25556 and r25557 but many more existed; this is a general fix and thus reverts r25556-r25557. * to avoid having PySequence_Repeat()/PySequence_Concat() failing on user-defined classes, they now fall back to nb_add/nb_mul if sq_concat/sq_repeat are not defined and the arguments appear to be sequences. * added tests. Backport candidate.
* Convert iterator __len__() methods to a private API.Raymond Hettinger2005-09-241-1/+26
|
* SF bug #1242657: list(obj) can swallow KeyboardInterruptRaymond Hettinger2005-08-211-0/+5
| | | | | | Fix over-aggressive PyErr_Clear(). The same code fragment appears in various guises in list.extend(), map(), filter(), zip(), and internally in PySequence_Tuple().
* Fix:Michael W. Hudson2005-07-121-8/+13
| | | | | | | [ 1229429 ] missing Py_DECREF in PyObject_CallMethod Add a test in test_enumerate, which is a bit random, but suffices (reversed_new calls PyObject_CallMethod under some circumstances).
* Make subclasses of int, long, complex, float, and unicode perform typeBrett Cannon2005-04-261-47/+37
| | | | | | | conversion using the proper magic slot (e.g., __int__()). Also move conversion code out of PyNumber_*() functions in the C API into the nb_* function. Applied patch #1109424. Thanks Walter Doewald.
* Small boost to PySequence_Fast(). Lists build faster than tuples forRaymond Hettinger2004-12-181-1/+1
| | | | unsized iterable inputs.
* Add missing decref.Raymond Hettinger2004-12-161-0/+1
|
* SF bug #1085744: Performance issues with PySequence_Tuple()Raymond Hettinger2004-12-161-4/+14
| | | | | | | * Added missing error checks. * Fixed O(n**2) growth pattern. Modeled after lists to achieve linear amortized resizing. Improves construction of "tuple(it)" when "it" is large and does not have a __len__ method. Other cases are unaffected.
* SF bug #1030557: PyMapping_Check crashes when argument is NULLRaymond Hettinger2004-09-191-2/+2
| | | | | | Make PySequence_Check() and PyMapping_Check() handle NULL inputs. This goes beyond what most of the other checks do, but it is nice defensive programming and solves the OP's problem.
* Check the type of values returned by __int__, __float__, __long__,Neil Schemenauer2004-07-191-6/+33
| | | | | | __oct__, and __hex__. Raise TypeError if an invalid type is returned. Note that PyNumber_Int and PyNumber_Long can still return ints or longs. Fixes SF bug #966618.
* SF bug #952866: "can't multiply sequence *by* non-int"Raymond Hettinger2004-05-121-1/+1
| | | | Minor wording fix.
* Improve previous checkin to use a slot check instead of equivalentRaymond Hettinger2004-04-051-1/+2
| | | | attribute name lookup.
* Improve accuracy of sequence and mapping checks.Raymond Hettinger2004-04-041-2/+8
|
* recursive_isinstance(), recursive_issubclass(): New code here returnedTim Peters2004-03-211-2/+2
| | | | | NULL in case of error, but the functions are declared to return int. MSVC 6 properly complains about that. Return -1 on error instead.
* Limit the nesting depth of a tuple passed as the second argument toBrett Cannon2004-03-201-9/+36
| | | | isinstance() or issubclass() to the recursion limit of the interpreter.
* Add missing decrefRaymond Hettinger2004-03-171-0/+1
|
* Eliminate a big block of duplicate code in PySequence_List() byRaymond Hettinger2004-03-111-54/+6
| | | | exposing _PyList_Extend().
* SF Patch #871704: Py_SequenceFast can mask errorsRaymond Hettinger2004-01-111-3/+11
| | | | | | | (Contributed by Greg Chapman.) Since this only changes the error message, I doubt that it should be backported.
* Apply pre-sizing optimization to a broader class of objects.Raymond Hettinger2004-01-041-8/+4
| | | | | Formerly, the length was only fetched from sequence objects. Now, any object that reports its length can benefit from pre-sizing.
* Apply tuple/list pre-sizing optimization to a broader class of objects.Raymond Hettinger2004-01-041-1/+1
| | | | | | | | Formerly, length data fetched from sequence objects. Now, any object that reports its length can benefit from pre-sizing. On one sample timing, it gave a threefold speedup for list(s) where s was a set object.
* Fix Greg Ward's error message nit: PyObject_SetItem and PySequenceSetItemRaymond Hettinger2003-10-271-1/+1
| | | | had slightly different error messages.
* Removed duplicate test from inner loop.Raymond Hettinger2003-03-011-6/+1
| | | | The PyIter_Check is already performed by PyObject_GetIter.
* Make PyNumber_Check() a bit more careful, since all sorts of thingsGuido van Rossum2003-02-181-1/+3
| | | | now have tp_as_number. Check for nb_int or nb_float.
* Add missing cast in previous fix.Guido van Rossum2003-02-121-1/+2
|
* SF #532767: isinstance(x, X) should work when x is a proxy for an XGuido van Rossum2003-02-121-6/+19
| | | | | instance, as long as x.__class__ is X or a subclass thereof. Did a little cleanup of PyObject_IsInstance() too.
* Fold long lines.Guido van Rossum2003-02-101-4/+7
|
* Merge to trunk from release branch:Guido van Rossum2002-12-311-0/+1
| | | | Plug the leak that Tim just reported.
* 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.
* Change issubclass() so that recursive tuples (directly or indirectlyWalter Dörwald2002-12-121-4/+4
| | | | | | 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-121-28/+42
| | | | | | | | | | | 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.
* 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.
* Simplify use of NB_BINOP and NB_TERNOP by making them do the pointerNeil Schemenauer2002-11-241-15/+15
| | | | dereference rather than the caller.
* Remove special handling of str and unicode in PyNumber_InPlaceRemainder. TheyNeil Schemenauer2002-11-241-9/+2
| | | | both have a nb_remainer slot.
* str and unicode objects now have a __mod__ slot so don't special case them inNeil Schemenauer2002-11-181-6/+0
| | | | | PyNumber_Remainder(). This fixes SF bug #615506 and allows string and unicode subclasses to override __mod__.
* Use PyList_CheckExact and PyTuple_CheckExact for checking whetherMichael W. Hudson2002-11-051-1/+1
| | | | PySequence_Fast needs to do anything siginificant.
* Squash a few calls to the hideously expensive PyObject_CallObject(o,a)Guido van Rossum2002-08-161-2/+2
| | | | | | | -- replace then with slightly faster PyObject_Call(o,a,NULL). (The difference is that the latter requires a to be a tuple; the former allows other values and wraps them in a tuple if necessary; it involves two more levels of C function calls to accomplish all that.)
* Patch #554716: Use __va_copy where available.Martin v. Löwis2002-07-281-0/+4
|