summaryrefslogtreecommitdiff
path: root/Objects/rangeobject.c
Commit message (Collapse)AuthorAgeFilesLines
* Recorded merge of revisions 81032 via svnmerge fromAntoine Pitrou2010-05-091-127/+127
| | | | | | | | | | | | | | | | | svn+ssh://pythondev@svn.python.org/python/branches/py3k ................ r81032 | antoine.pitrou | 2010-05-09 17:52:27 +0200 (dim., 09 mai 2010) | 9 lines Recorded merge of revisions 81029 via svnmerge from svn+ssh://pythondev@svn.python.org/python/trunk ........ r81029 | antoine.pitrou | 2010-05-09 16:46:46 +0200 (dim., 09 mai 2010) | 3 lines Untabify C files. Will watch buildbots. ........ ................
* Merged revisions 76319 via svnmerge fromBenjamin Peterson2009-11-161-20/+17
| | | | | | | | | | | | svn+ssh://pythondev@svn.python.org/python/branches/py3k ........ r76319 | benjamin.peterson | 2009-11-15 18:34:25 -0600 (Sun, 15 Nov 2009) | 4 lines fix one visible and several possible refleaks in rangeobject.c In some cases, the code was just reordered to allow for less decrefing. ........
* Merged revisions 76298 via svnmerge fromMark Dickinson2009-11-151-1/+4
| | | | | | | | | | svn+ssh://pythondev@svn.python.org/python/branches/py3k ........ r76298 | mark.dickinson | 2009-11-15 12:56:08 +0000 (Sun, 15 Nov 2009) | 1 line Fix another case of potential signed overflow. ........
* Merged revisions 76292-76293 via svnmerge fromMark Dickinson2009-11-151-55/+111
| | | | | | | | | | | | | | | | | | svn+ssh://pythondev@svn.python.org/python/branches/py3k ........ r76292 | mark.dickinson | 2009-11-15 09:57:26 +0000 (Sun, 15 Nov 2009) | 6 lines Issue #7298: Fix a variety of problems leading to wrong results with the fast versions of range.__reversed__ and range iteration. Also fix wrong results and a refleak for PyLong version of range.__reversed__. Thanks Eric Smith for reviewing, and for suggesting improved tests. ........ r76293 | mark.dickinson | 2009-11-15 10:04:50 +0000 (Sun, 15 Nov 2009) | 1 line r76292 commit accidentally committed some extra code; remove it ........
* Merged revisions 74613,74615,74619-74620,74622 via svnmerge fromGeorg Brandl2009-09-011-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | svn+ssh://svn.python.org/python/branches/py3k ................ r74613 | georg.brandl | 2009-09-01 09:34:27 +0200 (Di, 01 Sep 2009) | 1 line #6814: remove traces of xrange(). ................ r74615 | georg.brandl | 2009-09-01 09:42:40 +0200 (Di, 01 Sep 2009) | 9 lines Recorded merge of revisions 74614 via svnmerge from svn+ssh://pythondev@svn.python.org/python/trunk ........ r74614 | georg.brandl | 2009-09-01 09:40:54 +0200 (Di, 01 Sep 2009) | 1 line #6813: better documentation for numberless string formats. ........ ................ r74619 | georg.brandl | 2009-09-01 10:02:03 +0200 (Di, 01 Sep 2009) | 1 line #6754: remove old struct member nb_inplace_divide. ................ r74620 | georg.brandl | 2009-09-01 10:03:26 +0200 (Di, 01 Sep 2009) | 1 line #6732: fix return value of module init function in example. ................ r74622 | georg.brandl | 2009-09-01 10:11:14 +0200 (Di, 01 Sep 2009) | 73 lines Merged revisions 74542,74544-74548,74550,74554-74555,74578,74588,74590,74603,74616-74618,74621 via svnmerge from svn+ssh://pythondev@svn.python.org/python/trunk ........ r74542 | georg.brandl | 2009-08-23 23:28:56 +0200 (So, 23 Aug 2009) | 1 line Restore alphabetic order. ........ r74544 | georg.brandl | 2009-08-24 19:12:30 +0200 (Mo, 24 Aug 2009) | 1 line #6775: fix python.org URLs in README. ........ r74545 | georg.brandl | 2009-08-24 19:14:29 +0200 (Mo, 24 Aug 2009) | 1 line #6772: mention utf-8 as utf8 alias. ........ r74546 | georg.brandl | 2009-08-24 19:20:40 +0200 (Mo, 24 Aug 2009) | 1 line #6725: spell "namespace" consistently. ........ r74547 | georg.brandl | 2009-08-24 19:22:05 +0200 (Mo, 24 Aug 2009) | 1 line #6718: fix example. ........ r74548 | georg.brandl | 2009-08-24 19:24:27 +0200 (Mo, 24 Aug 2009) | 1 line #6677: mention "deleting" as an alias for removing files. ........ r74550 | georg.brandl | 2009-08-24 19:48:40 +0200 (Mo, 24 Aug 2009) | 1 line #6677: note that rmdir only removes empty directories. ........ r74554 | georg.brandl | 2009-08-27 20:59:02 +0200 (Do, 27 Aug 2009) | 1 line Typo fix. ........ r74555 | georg.brandl | 2009-08-27 21:02:43 +0200 (Do, 27 Aug 2009) | 1 line #6787: reference fix. ........ r74578 | tarek.ziade | 2009-08-29 15:33:21 +0200 (Sa, 29 Aug 2009) | 1 line fixed #6801: symmetric_difference_update also accepts pipe ........ r74588 | georg.brandl | 2009-08-30 10:35:01 +0200 (So, 30 Aug 2009) | 1 line #6803: fix old name. ........ r74590 | georg.brandl | 2009-08-30 13:51:53 +0200 (So, 30 Aug 2009) | 1 line #6801: fix copy-paste oversight. ........ r74603 | georg.brandl | 2009-08-31 08:38:29 +0200 (Mo, 31 Aug 2009) | 1 line other -> others where multiple arguments are accepted. ........ r74616 | georg.brandl | 2009-09-01 09:46:26 +0200 (Di, 01 Sep 2009) | 1 line #6808: clarification. ........ r74617 | georg.brandl | 2009-09-01 09:53:37 +0200 (Di, 01 Sep 2009) | 1 line #6765: hint that log(x, base) is not very sophisticated. ........ r74618 | georg.brandl | 2009-09-01 10:00:47 +0200 (Di, 01 Sep 2009) | 1 line #6810: add a link to the section about frame objects instead of just a description where to find it. ........ r74621 | georg.brandl | 2009-09-01 10:06:03 +0200 (Di, 01 Sep 2009) | 1 line #6638: fix wrong parameter name and markup a class. ........ ................
* Merged revisions 73656,73658,73663,73666 via svnmerge fromGeorg Brandl2009-08-131-4/+3
| | | | | | | | | | | | | | | | | | | | | | svn+ssh://svn.python.org/python/branches/py3k ........ r73656 | mark.dickinson | 2009-06-29 00:08:40 +0200 (Mo, 29 Jun 2009) | 1 line Fix description of range_length_obj ........ r73658 | raymond.hettinger | 2009-06-29 00:30:13 +0200 (Mo, 29 Jun 2009) | 1 line Small doc fix-ups to floatingpoint.rst. More are forthcoming. ........ r73663 | raymond.hettinger | 2009-06-29 01:21:38 +0200 (Mo, 29 Jun 2009) | 1 line Clean-up floating point tutorial. ........ r73666 | alexandre.vassalotti | 2009-06-29 03:13:41 +0200 (Mo, 29 Jun 2009) | 2 lines Make b64encode raises properly a TypeError when altchars is not bytes. ........
* this is also no longer trueBenjamin Peterson2009-06-241-3/+3
|
* fix commentBenjamin Peterson2009-06-241-5/+4
|
* Issue #6334: Fix buggy internal length calculation in builtin range functionMark Dickinson2009-06-241-9/+2
|
* Fix SystemError and a wasps nest of ref counting issues.Raymond Hettinger2009-06-121-8/+24
|
* Issue #1717: rename tp_compare to tp_reserved. I'll change theMark Dickinson2009-02-021-3/+3
| | | | | type of tp_compare in a separate commit, for ease of reversion should things go wrong.
* Issue #1717, stage 2: remove uses of tp_compare in Modules and mostMark Dickinson2009-02-011-6/+5
| | | | Objects.
* Issue 2582: Fix pickling of range objects.Alexandre Vassalotti2008-06-101-0/+9
|
* #2689 Fix indentation in Objects/rangeobject.cBenjamin Peterson2008-04-251-2/+2
|
* Merge r60673Raymond Hettinger2008-02-091-1/+1
|
* Drop _PyLong_FitsInLong. Fixes #1666.Martin v. Löwis2007-12-201-21/+36
|
* Cleanup: Replaced most PyInt_ aliases with PyLong_ and disabled the aliases ↵Christian Heimes2007-12-021-6/+6
| | | | in intobject.h
* Added all PyTypeObjects to the appropriate header files.Christian Heimes2007-11-291-6/+6
| | | | Before the patch a lot of internal types weren't available in the header files. The patch exposes the new iterators, views and some other types to all C modules. I've also renamed some of the types and tp_names.
* Added view and iterator types to collections / _abcollChristian Heimes2007-11-281-1/+1
| | | | I've also renamed several of the iterators to keep a consistent naming schema.
* Found another memory leak in longrangeiter. And redo the previous correctionAmaury Forgeot d'Arc2007-11-151-1/+2
| | | | | | | | | | | | | | | | without calling PyType_Ready(). Question 1: Should the interpreter register all types with PyType_Ready()? Many types seem to avoid it. Question 2: To reproduce the problem, run the following code: def f(): while True: for a in iter(range(0,1,10**20)): pass f() And watch the memory used by the process. How do we test this in a unittest?
* Correct a memory leak: the range() object was not properly freed.Amaury Forgeot d'Arc2007-11-151-0/+1
|
* Merged revisions 56467-56482 via svnmerge fromMartin v. Löwis2007-07-211-6/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | svn+ssh://pythondev@svn.python.org/python/branches/p3yk ................ r56477 | martin.v.loewis | 2007-07-21 09:04:38 +0200 (Sa, 21 Jul 2007) | 11 lines Merged revisions 56466-56476 via svnmerge from svn+ssh://pythondev@svn.python.org/python/trunk ........ r56476 | martin.v.loewis | 2007-07-21 08:55:02 +0200 (Sa, 21 Jul 2007) | 4 lines PEP 3123: Provide forward compatibility with Python 3.0, while keeping backwards compatibility. Add Py_Refcnt, Py_Type, Py_Size, and PyVarObject_HEAD_INIT. ........ ................ r56478 | martin.v.loewis | 2007-07-21 09:47:23 +0200 (Sa, 21 Jul 2007) | 2 lines PEP 3123: Use proper C inheritance for PyObject. ................ r56479 | martin.v.loewis | 2007-07-21 10:06:55 +0200 (Sa, 21 Jul 2007) | 3 lines Add longintrepr.h to Python.h, so that the compiler can see that PyFalse is really some kind of PyObject*. ................ r56480 | martin.v.loewis | 2007-07-21 10:47:18 +0200 (Sa, 21 Jul 2007) | 2 lines Qualify SHIFT, MASK, BASE. ................ r56482 | martin.v.loewis | 2007-07-21 19:10:57 +0200 (Sa, 21 Jul 2007) | 2 lines Correctly refer to _ob_next. ................
* Rename test_xrange.py to test_range.py and fix theWalter Dörwald2007-05-211-2/+2
| | | | type name in various spots.
* repr(range(10)) now returns 'range(0, 10)' for clarity.Walter Dörwald2007-05-211-10/+3
|
* Change range_repr() to use %R for the start/stop/step attributes.Walter Dörwald2007-05-201-30/+6
|
* Add functions PyUnicode_Append() and PyUnicode_AppendAndDel() that mirrorWalter Dörwald2007-05-181-9/+9
| | | | | | | | | | | | | | | PyString_Concat() and PyString_ConcatAndDel() (the name PyUnicode_Concat() was already taken). Change PyObject_Repr() to always return a unicode object. Update all repr implementations to return unicode objects. Add a function PyObject_ReprStr8() that calls PyObject_Repr() and converts the result to an 8bit string. Use PyObject_ReprStr8() where using PyObject_Repr() can't be done straightforward.
* Merged revisions 55180-55183 via svnmerge fromGuido van Rossum2007-05-081-8/+13
| | | | | | | | | | svn+ssh://pythondev@svn.python.org/python/branches/p3yk ........ r55182 | neal.norwitz | 2007-05-07 23:03:06 -0700 (Mon, 07 May 2007) | 1 line Fix refleaks when using range with large values ........
* Merged revisions 55007-55179 via svnmerge fromGuido van Rossum2007-05-071-152/+557
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | svn+ssh://pythondev@svn.python.org/python/branches/p3yk ........ r55077 | guido.van.rossum | 2007-05-02 11:54:37 -0700 (Wed, 02 May 2007) | 2 lines Use the new print syntax, at least. ........ r55142 | fred.drake | 2007-05-04 21:27:30 -0700 (Fri, 04 May 2007) | 1 line remove old cruftiness ........ r55143 | fred.drake | 2007-05-04 21:52:16 -0700 (Fri, 04 May 2007) | 1 line make this work with the new Python ........ r55162 | neal.norwitz | 2007-05-06 22:29:18 -0700 (Sun, 06 May 2007) | 1 line Get asdl code gen working with Python 2.3. Should continue to work with 3.0 ........ r55164 | neal.norwitz | 2007-05-07 00:00:38 -0700 (Mon, 07 May 2007) | 1 line Verify checkins to p3yk (sic) branch go to 3000 list. ........ r55166 | neal.norwitz | 2007-05-07 00:12:35 -0700 (Mon, 07 May 2007) | 1 line Fix this test so it runs again by importing warnings_test properly. ........ r55167 | neal.norwitz | 2007-05-07 01:03:22 -0700 (Mon, 07 May 2007) | 8 lines So long xrange. range() now supports values that are outside -sys.maxint to sys.maxint. floats raise a TypeError. This has been sitting for a long time. It probably has some problems and needs cleanup. Objects/rangeobject.c now uses 4-space indents since it is almost completely new. ........ r55171 | guido.van.rossum | 2007-05-07 10:21:26 -0700 (Mon, 07 May 2007) | 4 lines Fix two tests that were previously depending on significant spaces at the end of a line (and before that on Python 2.x print behavior that has no exact equivalent in 3.0). ........
* Merge p3yk branch with the trunk up to revision 45595. This breaks a fairThomas Wouters2006-04-211-92/+83
| | | | | | | | | | | | | | | | | | | | number of tests, all because of the codecs/_multibytecodecs issue described here (it's not a Py3K issue, just something Py3K discovers): http://mail.python.org/pipermail/python-dev/2006-April/064051.html Hye-Shik Chang promised to look for a fix, so no need to fix it here. The tests that are expected to break are: test_codecencodings_cn test_codecencodings_hk test_codecencodings_jp test_codecencodings_kr test_codecencodings_tw test_codecs test_multibytecodec This merge fixes an actual test failure (test_weakref) in this branch, though, so I believe merging is the right thing to do anyway.
* Merge ssize_t branch.Martin v. Löwis2006-02-151-7/+7
|
* Renamed _length_cue() to __length_hint__(). See:Armin Rigo2006-02-111-2/+2
| | | | http://mail.python.org/pipermail/python-dev/2006-February/060524.html
* Convert iterator __len__() methods to a private API.Raymond Hettinger2005-09-241-8/+10
|
* Disallow keyword arguments for type constructors that don't use them.Georg Brandl2005-08-261-0/+3
| | | | (fixes bug #1119418)
* Remove PyRange_New().Raymond Hettinger2004-12-031-45/+0
|
* Bug 1003935: xrange overflowsTim Peters2004-08-081-1/+16
| | | | | | | | | | | | | | | Added XXX comment about why the undocumented PyRange_New() API function is too broken to be worth the considerable pain of repairing. Changed range_new() to stop using PyRange_New(). This fixes a variety of bogus errors. Nothing in the core uses PyRange_New() now. Documented that xrange() is intended to be simple and fast, and that CPython restricts its arguments, and length of its result sequence, to native C longs. Added some tests that failed before the patch, and repaired a test that relied on a bogus OverflowError getting raised.
* Trimmed trailing whitespace.Tim Peters2004-08-081-5/+5
|
* Add a missing decref.Michael W. Hudson2004-08-021-0/+1
|
* Tidied up the implementations of reversed (including the custom onesRaymond Hettinger2004-03-101-1/+13
| | | | | | | | | | | | | | | | | for xrange and list objects). * list.__reversed__ now checks the length of the sequence object before calling PyList_GET_ITEM() because the mutable could have changed length. * all three implementations are now tranparent with respect to length and maintain the invariant len(it) == len(list(it)) even when the underlying sequence mutates. * __builtin__.reversed() now frees the underlying sequence as soon as the iterator is exhausted. * the code paths were rearranged so that the most common paths do not require a jump.
* Implement and apply PEP 322, reverse iterationRaymond Hettinger2003-11-061-1/+36
|
* Renamed PyObject_GenericGetIter to PyObject_SelfIterRaymond Hettinger2003-03-171-1/+1
| | | | | | to more accurately describe what the function does. Suggested by Thomas Wouters.
* Created PyObject_GenericGetIter().Raymond Hettinger2003-03-171-8/+1
| | | | Factors out the common case of returning self.
* Update comments about the performance of xrange().Raymond Hettinger2002-12-111-2/+2
|
* Restore attribute access so that the following work again:Raymond Hettinger2002-11-071-1/+1
| | | | | dir(xrange(10)) xrange(10).__getitem__(4)
* Untested code for 64-bit platforms. range_length() is declared as intGuido van Rossum2002-09-111-1/+8
| | | | | | | | | | but returns r->len which is a long. This doesn't even cause a warning on 32-bit platforms, but can return bogus values on 64-bit platforms (and should cause a compiler warning). Fix this by inserting a range check when LONG_MAX != INT_MAX, and adding an explicit cast to (int) when the test passes. When r->len is out of range, PySequence_Size() and hence len() will report an error (but an iterator will still work).
* staticforward bites the dust.Jeremy Hylton2002-07-171-2/+2
| | | | | | | | | | | | | | | The staticforward define was needed to support certain broken C compilers (notably SCO ODT 3.0, perhaps early AIX as well) botched the static keyword when it was used with a forward declaration of a static initialized structure. Standard C allows the forward declaration with static, and we've decided to stop catering to broken C compilers. (In fact, we expect that the compilers are all fixed eight years later.) I'm leaving staticforward and statichere defined in object.h as static. This is only for backwards compatibility with C extensions that might still use it. XXX I haven't updated the documentation.
* Remove the next() method -- one is supplied automatically byGuido van Rossum2002-07-161-10/+1
| | | | | | PyType_Ready() because the tp_iternext slot is set. Also removed the redundant (and expensive!) call to raise StopIteration from rangeiter_next().
* Patch #568124: Add doc string macros.Martin v. Löwis2002-06-131-2/+2
|
* Pyrangeiter_Type && range_iter should be staticNeal Norwitz2002-06-061-5/+5
|
* Skip Montanaro's patch, SF 559833, exposing xrange type in builtins.Raymond Hettinger2002-06-051-2/+84
| | | | | Also, added more regression tests to cover the new type and test its conformity with range().
* SF 564601 adding rangeiterobject to make xrange() iterate like range().Raymond Hettinger2002-06-051-46/+91
|