summaryrefslogtreecommitdiff
path: root/Objects/rangeobject.c
AgeCommit message (Collapse)AuthorLines
2002-05-02Fix attribute access for the xrange objects. The tp_getattr and tp_getattroFred Drake-30/+37
handlers were both set, but were not compatible. This change uses only the tp_getattro handler with a more "modern" approach. This fixes SF bug #551285.
2002-02-06Fix a bunch of typos found by nnorwitz.Michael W. Hudson-1/+1
2001-12-04long_mul(): The PyNumber_Multiply() call can return a long if theGuido van Rossum-0/+6
result would overflow an int. Check for this. (SF bug #488482, Armin Rigo.)
2001-08-24repr's converted to using PyString_FromFormat() instead of sprintf'ingBarry Warsaw-19/+19
into a hardcoded char* buffer. Closes patch #454743.
2001-08-16Patch #427190: Implement and use METH_NOARGS and METH_O.Martin v. Löwis-4/+1
2001-08-02Merge of descr-branch back into trunk.Tim Peters-16/+28
2001-07-09Re-add 'advanced' xrange features, adding DeprecationWarnings as discussedThomas Wouters-16/+219
on python-dev. The features will still vanish, however, just one release later.
2001-07-05Rip out the fancy behaviors of xrange that nobody uses: repeat, slice,Guido van Rossum-222/+15
contains, tolist(), and the start/stop/step attributes. This includes removing the 4th ('repeat') argument to PyRange_New().
2001-01-15SF patch #103158 by Greg Ball: Don't do unsafe arithmetic in xrangeGuido van Rossum-10/+80
object. This fixes potential overflows in xrange()'s internal calculations on 64-bit platforms. The fix is complicated because the sq_length slot function can only return an int; we want to support xrange(sys.maxint), which is a 64-bit quantity on most 64-bit platforms (except Win64). The solution is hacky but the best possible: when the range is that long, we can use it in a for loop but we can't ask for its length (nor can we actually iterate beyond 2**31-1, because the sq_item slot function has the same restrictions on its arguments. Fixing those restrictions is a project for another day...
2000-12-14Test for NULL returned from PyObject_NEW().Guido van Rossum-0/+3
2000-11-08Fixed support for containment test when a negative step is used; thisFred Drake-8/+34
*really* closes bug #121965. Added three attributes to the xrange object: start, stop, and step. These are the same as for the slice objects.
2000-11-08In the containment test, get the boundary condition right. ">" was usedFred Drake-2/+2
where ">=" should have been. This closes bug #121965.
2000-09-01REMOVED all CWI, CNRI and BeOpen copyright markings.Guido van Rossum-9/+0
This should match the situation in the 1.6b1 tree.
2000-08-04Boost buffer sizes in the absence of snprintf on Windows.Tim Peters-14/+19
Ensure that # of args to sprintf always matches # of format specifiers.
2000-08-04snprintf() is not portable, so continue to use sprintf() until a portableFred Drake-8/+6
snprintf() is available.
2000-08-03Remove the tp_print handler.Fred Drake-31/+27
Revise the tp_repr handler to produce a more "minimal" presentation. Make the tolist() method use PyArg_ParseTuple() and provide a docstring.
2000-07-09ANSI-fication of the sources.Fred Drake-36/+13
2000-06-30Change copyright notice - 2nd try.Guido van Rossum-6/+0
2000-06-30Change copyright notice.Guido van Rossum-21/+6
2000-06-15Thomas Wouters <thomas@xs4all.net>:Fred Drake-0/+25
The following patch adds "sq_contains" support to rangeobject, and enables the already-written support for sq_contains in listobject and tupleobject. The rangeobject "contains" code should be a bit more efficient than the current default "in" implementation ;-) It might not get used much, but it's not that much to add. listobject.c and tupleobject.c already had code for sq_contains, and the proper struct member was set, but the PyType structure was not extended to include tp_flags, so the object-specific code was not getting called (Go ahead, test it ;-). I also did this for the immutable_list_type in listobject.c, eventhough it is probably never used. Symmetry and all that.
2000-05-03Vladimir Marangozov's long-awaited malloc restructuring.Guido van Rossum-1/+1
For more comments, read the patches@python.org archives. For documentation read the comments in mymalloc.h and objimpl.h. (This is not exactly what Vladimir posted to the patches list; I've made a few changes, and Vladimir sent me a fix in private email for a problem that only occurs in debug mode. I'm also holding back on his change to main.c, which seems unnecessary to me.)
1999-01-09Use 'xrange', not 'range', in error messages. Reported by Nathan Sullivan.Guido van Rossum-3/+3
1997-05-02Quickly renamed the last directory.Guido van Rossum-40/+41
1996-12-05Make gcc -Wall happyGuido van Rossum-1/+1
1996-10-25New permission notice, includes CNRI.Guido van Rossum-12/+19
1996-07-22Use NEWOBJ() macro instead of calling newobject() directly.Guido van Rossum-1/+1
1995-01-17make a few things staticGuido van Rossum-2/+2
1995-01-04Added 1995 to copyright message.Guido van Rossum-2/+2
floatobject.c: fix hash(). methodobject.c: support METH_FREENAME flag bit.
1994-09-28 * Include/classobject.h, Objects/classobject.c, Python/ceval.c:Guido van Rossum-14/+14
entirely redone operator overloading. The rules for class instances are now much more relaxed than for other built-in types (whose coerce must still return two objects of the same type) * Objects/floatobject.c: add overflow check when converting float to int and implement truncation towards zero using ceil/float * Objects/longobject.c: change ValueError to OverflowError when converting to int * Objects/rangeobject.c: modernized * Objects/stringobject.c: use HAVE_LIMITS instead of __STDC__ * Objects/xxobject.c: changed to use new style (not finished?)
1993-12-21* rangeobject.[ch], bltinmodule.c: incorporate new version of rangeGuido van Rossum-23/+127
object (unchanged from source except "range" -> "xrange").
1993-11-01* rangeobject.{c,h}, bltinmodule.c: removed non-essential ops from rangeGuido van Rossum-79/+27
object.
1993-10-26* compile.[ch]: support for lambda()Guido van Rossum-0/+205
* PROTO.h, mymalloc.h: added #ifdefs for TURBOC and GNUC. * allobjects.h: added #include "rangeobject.h" * Grammar: added lambda_input; relaxed syntax for exec. * bltinmodule.c: added bagof, map, reduce, lambda, xrange. * tupleobject.[ch]: added resizetuple(). * rangeobject.[ch]: new object type to speed up range operations (not convinced this is needed!!!)