summaryrefslogtreecommitdiffstats
path: root/Objects/tupleobject.c
Commit message (Collapse)AuthorAgeFilesLines
* 00147-add-debug-malloc-stats.patchFedora Python maintainers2020-09-291-0/+16
| | | | | | | 00147 # Add a sys._debugmallocstats() function Based on patch 202 from RHEL 5's python.spec, with updates from rhbz#737198 Sent upstream as http://bugs.python.org/issue14785
* [2.7] bpo-32137: The repr of deeply nested dict now raises a RuntimeError ↵Serhiy Storchaka2018-02-021-3/+0
| | | | | | | | | (GH-4570) (#5493) instead of crashing due to a stack overflow. This perhaps will fix similar problems in other extension types. (cherry picked from commit 1fb72d2ad243c965d4432b4e93884064001a2607)
* bpo-30074: Fix compile warnings of _PySlice_Unpack and convert missed (#1154)Serhiy Storchaka2017-04-151-1/+1
| | | | PySlice_GetIndicesEx in _ctypes.c.
* bpo-27867: Expand the PySlice_GetIndicesEx macro. (#1023) (#1046)Serhiy Storchaka2017-04-081-3/+3
| | | | (cherry picked from commit b879fe8)
* bpo-29935: Fixed error messages in the index() method of tuple and list ↵Serhiy Storchaka2017-03-301-2/+2
| | | | | | | (#887) (#907) (#910) when pass indices of wrong type. (cherry picked from commit d4edfc9abffca965e76ebc5957a92031a4d6c4d4) (cherry picked from commit bf4bb2e43030661e568d5d4b046e8b9351cc164c)
* Issue #26494: Fixed crash on iterating exhausting iterators.Serhiy Storchaka2016-03-301-1/+1
| | | | | Affected classes are generic sequence iterators, iterators of bytearray, list, tuple, set, frozenset, dict, OrderedDict and corresponding views.
* Issue #23629: Fix the default __sizeof__ implementation for variable-sized ↵Antoine Pitrou2015-03-101-12/+0
| | | | objects.
* Issue #20437: Fixed 43 potential bugs when deleting objects references.Serhiy Storchaka2014-02-091-4/+2
|
* PyTuple_Pack() was missing va_end() in its error branch which lead to a ↵Christian Heimes2012-09-101-1/+3
| | | | resource leak.
* Revert "Accept None as start and stop parameters for list.index() and ↵Petri Lehtinen2011-11-061-11/+4
| | | | | | tuple.index()" Issue #13340.
* Accept None as start and stop parameters for list.index() and tuple.index()Petri Lehtinen2011-11-051-4/+11
| | | | Closes #13340.
* Untabify C files. Will watch buildbots.Antoine Pitrou2010-05-091-754/+754
|
* Remove an unneeded variable assignment.Brett Cannon2010-05-051-2/+1
| | | | Found using Clang's static analyzer.
* #8030: more docstring fix for builtin types.Ezio Melotti2010-02-281-4/+4
|
* Issue #7466: segmentation fault when the garbage collector is calledAntoine Pitrou2009-12-121-1/+2
| | | | | | in the middle of populating a tuple. Patch by Florent Xicluna. (note: no NEWS entry for trunk since the bug was introduced in 2.7/3.1)
* The tracking statistics were actually too pessimisticAntoine Pitrou2009-03-231-3/+3
|
* Issue #4688: Add a heuristic so that tuples and dicts containing onlyAntoine Pitrou2009-03-231-0/+54
| | | | | | | | | untrackable objects are not tracked by the garbage collector. This can reduce the size of collections and therefore the garbage collection overhead on long-running programs, depending on their particular use of datatypes. (trivia: this makes the "binary_trees" benchmark from the Computer Language Shootout 40% faster)
* fix tuple.index() error message #5495Benjamin Peterson2009-03-151-1/+1
|
* Issue #4850: Change COUNT_ALLOCS variables to Py_ssize_t.Martin v. Löwis2009-01-071-2/+2
|
* Docstring change: Specify exception raisedAndrew M. Kuchling2008-10-041-1/+3
|
* Security patches from Apple: prevent int overflow when allocating memoryNeal Norwitz2008-07-311-2/+3
|
* Fixed: sys.getsizeof does not take the actual length of the tuples into account.Robert Schuppenies2008-06-131-0/+12
|
* This reverts r63675 based on the discussion in this thread:Gregory P. Smith2008-06-091-8/+8
| | | | | | | http://mail.python.org/pipermail/python-dev/2008-June/079988.html Python 2.6 should stick with PyString_* in its codebase. The PyBytes_* names in the spirit of 3.0 are available via a #define only. See the email thread.
* Renamed PyString to PyBytesChristian Heimes2008-05-261-8/+8
|
* Implemented Martin's suggestion to clear the free lists during the garbage ↵Christian Heimes2008-02-141-6/+19
| | | | collection of the highest generation.
* Return ints instead of longs for tuple.count() and tuple.index().Raymond Hettinger2008-02-071-2/+2
|
* Issue 2025: Add tuple.count() and tuple.index() to follow the ABC in ↵Raymond Hettinger2008-02-071-0/+54
| | | | collections.Sequence.
* Unified naming convention for free lists and their limits. All free listsChristian Heimes2008-02-061-29/+29
| | | | | | | | in Object/ are named ``free_list``, the counter ``numfree`` and the upper limit is a macro ``PyName_MAXFREELIST`` inside an #ifndef block. The chances should make it easier to adjust Python for platforms with less memory, e.g. mobile phones.
* #1629: Renamed Py_Size, Py_Type and Py_Refcnt to Py_SIZE, Py_TYPE and ↵Christian Heimes2007-12-191-36/+36
| | | | Py_REFCNT. Macros for b/w compatibility are available.
* Fix error introduced by r58288; if a tuple is length 0 return its repr andBrett Cannon2007-09-301-4/+4
| | | | don't worry about any self-referring tuples.
* tuple.__repr__ did not consider a reference loop as it is not possible fromBrett Cannon2007-09-301-0/+13
| | | | | | | | | | Python code; but it is possible from C. object.__str__ had the issue of not expecting a type to doing something within it's tp_str implementation that could trigger an infinite recursion, but it could in C code.. Both found thanks to BaseException and how it handles its repr. Closes issue #1686386. Thanks to Thomas Herve for taking an initial stab at coming up with a solution.
* Add a bunch of GIL release/acquire points in tp_print implementations and forBrett Cannon2007-09-171-2/+10
| | | | | | PyObject_Print(). Closes issue #1164.
* Improve extended slicing support in builtin types and classes. Specifically:Thomas Wouters2007-08-281-0/+6
| | | | | | | | | | | | | | | | | | | | - Specialcase extended slices that amount to a shallow copy the same way as is done for simple slices, in the tuple, string and unicode case. - Specialcase step-1 extended slices to optimize the common case for all involved types. - For lists, allow extended slice assignment of differing lengths as long as the step is 1. (Previously, 'l[:2:1] = []' failed even though 'l[:2] = []' and 'l[:2:None] = []' do not.) - Implement extended slicing for buffer, array, structseq, mmap and UserString.UserString. - Implement slice-object support (but not non-step-1 slice assignment) for UserString.MutableString. - Add tests for all new functionality.
* PEP 3123: Provide forward compatibility with Python 3.0, while keepingMartin v. Löwis2007-07-211-40/+38
| | | | | backwards compatibility. Add Py_Refcnt, Py_Type, Py_Size, and PyVarObject_HEAD_INIT.
* Variation of patch # 1624059 to speed up checking if an object is a subclassNeal Norwitz2007-02-251-1/+1
| | | | | | | | | | | | | | | | | | of some of the common builtin types. Use a bit in tp_flags for each common builtin type. Check the bit to determine if any instance is a subclass of these common types. The check avoids a function call and O(n) search of the base classes. The check is done in the various Py*_Check macros rather than calling PyType_IsSubtype(). All the bits are set in tp_flags when the type is declared in the Objects/*object.c files because PyType_Ready() is not called for all the types. Should PyType_Ready() be called for all types? If so and the change is made, the changes to the Objects/*object.c files can be reverted (remove setting the tp_flags). Objects/typeobject.c would also have to be modified to add conditions for Py*_CheckExact() in addition to each the PyType_IsSubtype check.
* Patch [ 1586791 ] better error msgs for some TypeErrorsGeorg Brandl2006-11-191-2/+3
|
* Patch #1538606, Patch to fix __index__() clipping.Neal Norwitz2006-08-121-5/+2
| | | | | | | I modified this patch some by fixing style, some error checking, and adding XXX comments. This patch requires review and some changes are to be expected. I'm checking in now to get the greatest possible review and establish a baseline for moving forward. I don't want this to hold up release if possible.
* Use Py_VISIT in all tp_traverse methods, instead of traversing manually orThomas Wouters2006-04-151-13/+5
| | | | | | | | using a custom, nearly-identical macro. This probably changes how some of these functions are compiled, which may result in fractionally slower (or faster) execution. Considering the nature of traversal, visiting much of the address space in unpredictable patterns, I'd argue the code readability and maintainability is well worth it ;P
* Remove "static forward" declaration. Move constructorsMartin v. Löwis2006-04-111-21/+19
| | | | after the type objects.
* More low-hanging fruit. Still need to re-arrange some code (or find a betterAnthony Baxter2006-04-111-5/+5
| | | | | solution) in the same way as listobject.c got changed. Hoping for a better solution.
* Fix some missing checks after PyTuple_New, PyList_New, PyDict_NewGeorg Brandl2006-03-171-0/+1
|
* Checking in the code for PEP 357.Guido van Rossum2006-03-071-2/+5
| | | | | | 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).
* 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-3/+4
| | | | Convert Py_ssize_t using PyInt_FromSsize_t
* Merge ssize_t branch.Martin v. Löwis2006-02-151-48/+44
|
* Renamed _length_cue() to __length_hint__(). See:Armin Rigo2006-02-111-2/+2
| | | | http://mail.python.org/pipermail/python-dev/2006-February/060524.html
* Add const to several API functions that take char *.Jeremy Hylton2005-12-101-1/+1
| | | | | | | | | | | | | | | | | | | In C++, it's an error to pass a string literal to a char* function without a const_cast(). Rather than require every C++ extension module to put a cast around string literals, fix the API to state the const-ness. I focused on parts of the API where people usually pass literals: PyArg_ParseTuple() and friends, Py_BuildValue(), PyMethodDef, the type slots, etc. Predictably, there were a large set of functions that needed to be fixed as a result of these changes. The most pervasive change was to make the keyword args list passed to PyArg_ParseTupleAndKewords() to be a const char *kwlist[]. One cast was required as a result of the changes: A type object mallocs the memory for its tp_doc slot and later frees it. PyTypeObject says that tp_doc is const char *; but if the type was created by type_new(), we know it is safe to cast to char *.
* Convert iterator __len__() methods to a private API.Raymond Hettinger2005-09-241-7/+12
|
* Add a final permutation step to the tuple hash function.Raymond Hettinger2004-06-101-0/+1
| | | | | Prevents a collision pattern that occurs with nested tuples. (Yitz Gale provided code that repeatably demonstrated the weakness.)
* Replaced arbitrary addend in tuple_hash with one that is known to generateRaymond Hettinger2004-06-041-1/+9
| | | | many more prime multipliers and that performs well on collision tests.