summaryrefslogtreecommitdiff
path: root/Modules/arraymodule.c
AgeCommit message (Collapse)AuthorLines
2008-03-02Backport of r61180:Martin v. Löwis-1/+33
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.
2003-08-06Backport SF bug #782369: Massive memory leak in array moduleRaymond Hettinger-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".
2003-05-23All calls to getarrayitem() (which is static) are done either in loopsWalter Dörwald-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().
2003-05-18Fix array.array.insert(), so that it treats negative indices asWalter Dörwald-2/+5
being relative to the end of the array, just like list.insert() does. This closes SF bug #739313.
2003-04-24SF 686323: Minor array module enhancementsRaymond Hettinger-4/+6
Allows use of tuples for the initializer.
2003-04-23SF Patch 685051: fix for 680789: reprs in arraymoduleRaymond Hettinger-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.
2003-03-17Renamed PyObject_GenericGetIter to PyObject_SelfIterRaymond Hettinger-1/+1
to more accurately describe what the function does. Suggested by Thomas Wouters.
2003-03-17Created PyObject_GenericGetIter().Raymond Hettinger-8/+1
Factors out the common case of returning self.
2003-02-24SF patch #687598, array.append is sloooowNeal Norwitz-2/+47
This improves speed by about 5.6% for me.
2003-02-10Patch #676837: Cygwin array module patchJason Tishler-1/+2
The attached patch enables the array module to build cleanly under Cygwin again.
2003-01-07SF patch #662433: Fill arraymodule's tp_iter and sq_contains slotsRaymond Hettinger-2/+121
2003-01-06Patch #661760: Cygwin auto-import module patchJason Tishler-8/+3
The attached patch enables shared extension modules to build cleanly under Cygwin without moving the static initialization of certain function pointers (i.e., ones exported from the Python DLL core) to a module initialization function. Additionally, this patch fixes the modules that have been changed in the past to accommodate Cygwin.
2003-01-03SF patch 660559: Use METH_O and METH_NOARGS where possibleRaymond Hettinger-67/+32
Simplify code and speed access by using PyArg_UnpackTuple, METH_O and METH_NOARGS in three modules that can benefit from it.
2002-08-02Excise DL_EXPORT/DL_IMPORT from Modules/*. Required adding a prototypeMark Hammond-1/+1
for Py_Main(). Thanks to Kalle Svensson and Skip Montanaro for the patches.
2002-07-29Fix forMichael W. Hudson-6/+7
[ 587875 ] crash on deleting extended slice The array code got simpler, always a good thing!
2002-07-17Removed more stray instances of statichere, but left _sre.c alone.Tim Peters-1/+1
2002-07-17staticforward bites the dust.Jeremy Hylton-1/+1
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.
2002-06-19Fix the bug described inMichael W. Hudson-1/+174
http://mail.python.org/pipermail/python-dev/2002-June/025461.html with test cases. Also includes extended slice support for arrays, which I thought I'd already checked in but obviously not.
2002-06-13Patch #568124: Add doc string macros.Martin v. Löwis-40/+40
2002-05-13array_tounicode isn't defined in --disable-unicode builds...Michael W. Hudson-0/+4
I have a patch to make the test work too, but it's not pretty so I'll submit it to sf.
2002-05-02Indicate delayed initialization of slots. Suggested by tim.one.Martin v. Löwis-3/+5
2002-05-02Patch #551009: Initialize array type dynamically.Martin v. Löwis-3/+6
2002-04-12PyObject_Del can now be used as a function designator.Neil Schemenauer-1/+1
2002-04-01Use the PyModule_*() API instead of manipulating the module dictionaryFred Drake-4/+6
directly.
2002-03-04Remove tp_print.Martin v. Löwis-34/+1
2002-03-01Patch 520694: arraymodule.c improvements:Martin v. Löwis-107/+316
- make array.array a type - add Py_UNICODE arrays - support +=, *=
2001-12-08Patch supplied by Burton Radons for his own SF bug #487390: ModifyingGuido van Rossum-1/+1
type.__module__ behavior. This adds the module name and a dot in front of the type name in every type object initializer, except for built-in types (and those that already had this). Note that it touches lots of Mac modules -- I have no way to test these but the changes look right. Apologies if they're not. This also touches the weakref docs, which contains a sample type object initializer. It also touches the mmap test output, because the mmap type's repr is included in that output. It touches object.h to put the correct description in a comment.
2001-11-28sprintf -> PyOS_snprintf in some "obviously safe" cases.Tim Peters-3/+4
Also changed <>-style #includes to ""-style in some places where the former didn't make sense.
2001-07-27Fix buffer_info() docstring to match reality. See SF bug #444842.Guido van Rossum-1/+3
2001-06-05Make it possible to find the use of tp_as_buffer here with a global search.Tim Peters-1/+1
(Just a change to a comment)
2001-01-25Correct one-line typo, reported by yole @ SF, bug 130077.Guido van Rossum-1/+1
2001-01-24The array type was missing the Py_TPFLAGS_DEFAULT initializer for theGuido van Rossum-1/+1
tp_flags. This will become important when I introduce Py_TPFLAGS_HAVE_RICHCOMPARE (as I should have!).
2001-01-18Same treatment as listobject.c:Guido van Rossum-67/+156
- In count(), remove(), index(): call RichCompare(Py_EQ). - Get rid of array_compare(), in favor of new array_richcompare() (a near clone of list_compare()). - Aligned items in array_methods initializer and comments for type struct initializer. - Folded a few long lines.
2000-11-10Fix for SF bug 117402, crashes on str(array) and repr(array). This was anTim Peters-3/+5
unfortunate consequence of somebody switching from PyArg_Parse to PyArg_ParseTuple but without changing the argument from a NULL to a tuple.
2000-09-26Rationalize use of limits.h, moving the inclusion to Python.h.Fred Drake-3/+0
Add definitions of INT_MAX and LONG_MAX to pyport.h. Remove includes of limits.h and conditional definitions of INT_MAX and LONG_MAX elsewhere. This closes SourceForge patch #101659 and bug #115323.
2000-09-16arraymodule: Fix SF bug 113960.Tim Peters-18/+23
reverse() didn't work at all due to bad arg check. Fixed that. Added Brad Chapman to ACKS file, as the proud new owner of two implicitly copyrighted lines of Python source code <wink>. Repaired buffer_info's total lack of arg-checking. Replaced memmove by memcpy in reverse() guts, as memmove is often slower and the memory areas are guaranteed disjoint. Replaced poke-and-hope unchecked decl of tmp buffer size by assert-checked larger tmp buffer. Got rid of inconsistent spaces before open paren in docstrings. Added reverse() sanity tests to test_array.py.
2000-09-10General cleanup in preparation for a bugfix: removed unused code, uselessTim Peters-65/+27
declarations, added some comments where I had to think too hard to understand what was happening, and changed the primary internal get/set functions to assert they're passed objects of the correct type instead of doing runtime tests for that (it's an internal error that "should never happen", so it's good enough to check it only in the debug build).
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-31Peter Schneider-Kamp <nowonder@nowonder.de>:Fred Drake-3/+1
Remove some of GCC's warning in -Wstrict-prototypes mode. This closes SourceForge patch #101342.
2000-08-12Use safer comparisons (only matters when sizeof(int) != sizeof(size_t)). freadTrent Mick-2/+2
and fwrite return size_t, so it is safer to cast up to the largest type for the comparison. I believe the cast is required at all to remove compiler warnings.
2000-08-01Removed decl of unreferenced vrbl.Tim Peters-1/+0
2000-07-31replaced PyArgs_Parse by PyArgs_ParseTuplePeter Schneider-Kamp-34/+39
changed error messages for extend method from "append" to "extend"
2000-07-31added count, extend, index, pop and remove to arraymodulePeter Schneider-Kamp-72/+168
2000-07-21Bunch of minor ANSIfications: 'void initfunc()' -> 'void initfunc(void)',Thomas Wouters-1/+1
and a couple of functions that were missed in the previous batches. Not terribly tested, but very carefully scrutinized, three times. All these were found by the little findkrc.py that I posted to python-dev, which means there might be more lurking. Cases such as this: long func(a, b) long a; long b; /* flagword */ { and other cases where the last ; in the argument list isn't followed by a newline and an opening curly bracket. Regexps to catch all are welcome, of course ;)
2000-07-13ANSI-fication (got lost in the deep seas of source forge <wink>)Peter Schneider-Kamp-195/+60
2000-07-09Nuke all remaining occurrences of Py_PROTO and Py_FPROTO.Tim Peters-8/+8
2000-07-01Jack Jansen, Mac patch:Guido van Rossum-0/+3
Include limits.h if we have it.
2000-07-01In b_setitem(), instead of the platform dependent CHAR_MIN andGuido van Rossum-2/+2
CHAR_MAX, use hardcoded -128 and 127. This may seem strange, unless you realize that we're talking about signed bytes here! Bytes are always 8 bits and 2's complement. CHAR_MIN and CHAR_MAX are properties of the char data type, which is guaranteed to hold at least 8 bits anyway. Otherwise you'd get failing tests on platforms where unsigned char is the default (e.g. AIX). Thanks, Vladimir Marangozov, for finding this nit!
2000-06-30Change copyright notice - 2nd try.Guido van Rossum-6/+0
2000-06-30Change copyright notice.Guido van Rossum-21/+6