summaryrefslogtreecommitdiffstats
path: root/Modules/arraymodule.c
Commit message (Collapse)AuthorAgeFilesLines
* Issue #2620: Overflow checking when allocating or reallocating memoryGregory P. Smith2008-07-221-1/+4
| | | | | | | | was not always being done properly in some python types and extension modules. PyMem_MALLOC, PyMem_REALLOC, PyMem_NEW and PyMem_RESIZE have all been updated to perform better checks and places in the code that would previously leak memory on the error path when such an allocation failed have been fixed.
* Make more symbols static.Martin v. Löwis2008-06-131-1/+1
|
* Fix some memory dealloc problems when exceptions occur.Neal Norwitz2008-06-131-8/+7
| | | | It caused: "Fatal Python error: UNREF invalid object" in the DoubleTest.
* Merge in release25-maint r60793:Gregory P. Smith2008-06-111-1/+37
| | | | | | Added checks for integer overflows, contributed by Google. Some are only available if asserts are left in the code, in cases where they can't be triggered from Python code.
* This reverts r63675 based on the discussion in this thread:Gregory P. Smith2008-06-091-9/+9
| | | | | | | 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-9/+9
|
* A little reformating of Py3k warningsBenjamin Peterson2008-04-271-2/+2
|
* Use PyErr_WarnPy3k throughoutBenjamin Peterson2008-04-271-8/+4
|
* #2359: add Py3k warning for array.read/array.write.Georg Brandl2008-03-251-2/+26
|
* #1629: Renamed Py_Size, Py_Type and Py_Refcnt to Py_SIZE, Py_TYPE and ↵Christian Heimes2007-12-191-120/+120
| | | | Py_REFCNT. Macros for b/w compatibility are available.
* Improve extended slicing support in builtin types and classes. Specifically:Thomas Wouters2007-08-281-92/+136
| | | | | | | | | | | | | | | | | | | | - 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-120/+118
| | | | | backwards compatibility. Add Py_Refcnt, Py_Type, Py_Size, and PyVarObject_HEAD_INIT.
* Array module's buffer interface can now handle empty arrays.Raymond Hettinger2007-04-021-0/+6
|
* SF #1693079: Cannot save empty array in shelveRaymond Hettinger2007-04-021-6/+13
|
* Bug #1486663: don't reject keyword arguments for subclasses of builtinGeorg Brandl2007-01-211-1/+1
| | | | types.
* Fix SF bug #1545837: array.array borks on deepcopy.Thomas Wouters2006-08-241-1/+1
| | | | | array.__deepcopy__() needs to take an argument, even if it doesn't actually use it. Will backport to 2.5 and 2.4 (if applicable.)
* Patch #1538606, Patch to fix __index__() clipping.Neal Norwitz2006-08-121-8/+4
| | | | | | | 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.
* Klocwork made another run and found a bunch more problems.Neal Norwitz2006-08-121-0/+4
| | | | | | | This is the first batch of fixes that should be easy to verify based on context. This fixes problem numbers: 220 (ast), 323-324 (symtable), 321-322 (structseq), 215 (array), 210 (hotshot), 182 (codecs), 209 (etree).
* Patch #1495999: Part two of Windows CE changes.Martin v. Löwis2006-06-101-2/+2
| | | | | | - update header checks, using autoconf - provide dummies for getenv, environ, and GetVersion - adjust MSC_VER check in socketmodule.c
* Buffer objects would return the read or write buffer for a wrapped object whenBrett Cannon2006-06-081-0/+1
| | | | | | | | | the char buffer was requested. Now it actually returns the char buffer if available or raises a TypeError if it isn't (as is raised for the other buffer types if they are not present but requested). Not a backport candidate since it does change semantics of the buffer object (although it could be argued this is enough of a bug to bother backporting).
* Support for buffer protocol for socket and struct.Martin Blais2006-05-261-3/+3
| | | | | | | | | | * Added socket.recv_buf() and socket.recvfrom_buf() methods, that use the buffer protocol (send and sendto already did). * Added struct.pack_to(), that is the corresponding buffer compatible method to unpack_from(). * Fixed minor typos in arraymodule.
* C++ compiler cleanup: a cast here, a cast there... still does not compile ↵Skip Montanaro2006-04-181-3/+4
| | | | under C++ though...
* Use Py_VISIT in all tp_traverse methods, instead of traversing manually orThomas Wouters2006-04-151-2/+1
| | | | | | | | 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
* Whitespace: break long lineNeal Norwitz2006-04-031-1/+2
|
* Checking in the code for PEP 357.Guido van Rossum2006-03-071-18/+11
| | | | | | 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).
* SF #1444030: Fix several potential defects found by Coverity.Hye-Shik Chang2006-03-071-4/+7
| | | | (reviewed by Neal Norwitz)
* Convert array.array.insert to use Py_ssize_t (like the rest already does.)Thomas Wouters2006-02-271-2/+2
|
* Bug #1432350: arrayobject should use PyObject_VAR_HEADGeorg Brandl2006-02-171-2/+1
|
* Use correct format specifier for Py_ssize_t variable to PyArg_ParseTuple().Thomas Wouters2006-02-161-1/+1
|
* Use Py_ssize_t for counts and sizes.Martin v. Löwis2006-02-161-16/+13
|
* Merge ssize_t branch.Martin v. Löwis2006-02-151-94/+99
|
* Check return result from Py_InitModule*(). This API can fail.Neal Norwitz2006-01-191-0/+2
| | | | Probably should be backported.
* Disallow keyword arguments for type constructors that don't use them.Georg Brandl2005-08-261-12/+3
| | | | (fixes bug #1119418)
* SF #1085304: Make array.array pickle-ableRaymond Hettinger2004-12-161-0/+25
|
* SF feature request #992967: array.array objects should support sequences.Raymond Hettinger2004-08-291-6/+20
| | | | Made the constructor accept general iterables.
* Add weakref support to array.array and file objects.Raymond Hettinger2004-05-311-2/+7
|
* SF feature request #686323: Minor array module enhancementsRaymond Hettinger2004-03-141-9/+34
| | | | | | | array.extend() now accepts iterable arguments implements as a series of appends. Besides being a user convenience and matching the behavior for lists, this the saves memory and cycles that would be used to create a temporary array object.
* Update the array overallocation scheme to match the approach used forRaymond Hettinger2004-03-141-61/+76
| | | | | | | | lists. Speeds append() operations and reduces memory requirements (because of more conservative overallocation). Paves the way for the feature request for array.extend() to support arbitrary iterable arguments.
* SF bug #910986: copy.copy fails for array.arrayRaymond Hettinger2004-03-131-0/+15
| | | | Added support for the copy module.
* Simplify and speedup uses of Py_BuildValue():Raymond Hettinger2003-10-121-1/+1
| | | | | | * Py_BuildValue("(OOO)",a,b,c) --> PyTuple_Pack(3,a,b,c) * Py_BuildValue("()",a) --> PyTuple_New(0) * Py_BuildValue("O", a) --> Py_INCREF(a)
* SF bug #782369: Massive memory leak in array moduleRaymond Hettinger2003-08-051-2/+7
| | | | | | | | Fixed leak caused by switching from PyList_GetItem to PySequence_GetItem. Added missing NULL check. Clarified code by converting an "if" to an "else if". Will backport to 2.3.
* All calls to getarrayitem() (which is static) are done either in loopsWalter Dörwald2003-05-231-4/+1
| | | | | over the size of the array, or the callers check the index bounds themselves, so the index check never failed => Replace it with an assert().
* Fix array.array.insert(), so that it treats negative indices asWalter Dörwald2003-05-181-2/+5
| | | | | being relative to the end of the array, just like list.insert() does. This closes SF bug #739313.
* SF 686323: Minor array module enhancementsRaymond Hettinger2003-04-241-4/+6
| | | | Allows use of tuples for the initializer.
* SF Patch 685051: fix for 680789: reprs in arraymoduleRaymond Hettinger2003-04-231-30/+15
| | | | | | | | | | | | | (contributed by logistix; substantially reworked by rhettinger). To create a representation of non-string arrays, array_repr() was starting with a base Python string object and repeatedly using += to concatenate the representation of individual objects. Logistix had the idea to convert to an intermediate tuple form and then join it all at once. I took advantage of existing tools and formed a list with array_tolist() and got its representation through PyObject_Repr(v) which already has a fast implementation for lists.
* 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.
* SF patch #687598, array.append is sloooowNeal Norwitz2003-02-241-2/+47
| | | | This improves speed by about 5.6% for me.
* Patch #676837: Cygwin array module patchJason Tishler2003-02-101-1/+2
| | | | | The attached patch enables the array module to build cleanly under Cygwin again.
* SF patch #662433: Fill arraymodule's tp_iter and sq_contains slotsRaymond Hettinger2003-01-071-2/+121
|