Commit Graph

79 Commits

Author SHA1 Message Date
Mark Hammond fe51c6d66e Excise DL_EXPORT/DL_IMPORT from Modules/*. Required adding a prototype
for Py_Main().

Thanks to Kalle Svensson and Skip Montanaro for the patches.
2002-08-02 02:27:13 +00:00
Michael W. Hudson 56796f672f Fix for
[ 587875 ] crash on deleting extended slice

The array code got simpler, always a good thing!
2002-07-29 14:35:04 +00:00
Tim Peters 0c32279626 Removed more stray instances of statichere, but left _sre.c alone. 2002-07-17 16:49:03 +00:00
Jeremy Hylton 938ace69a0 staticforward bites the dust.
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-07-17 16:30:39 +00:00
Michael W. Hudson 9c14badc5f Fix the bug described in
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-19 15:44:15 +00:00
Martin v. Löwis 14f8b4cfcb Patch #568124: Add doc string macros. 2002-06-13 20:33:02 +00:00
Michael W. Hudson 1755ad9b02 array_tounicode isn't defined in --disable-unicode builds...
I have a patch to make the test work too, but it's not pretty so
I'll submit it to sf.
2002-05-13 10:14:59 +00:00
Martin v. Löwis b9132a2a15 Indicate delayed initialization of slots. Suggested by tim.one. 2002-05-02 20:34:12 +00:00
Martin v. Löwis edbffc1725 Patch #551009: Initialize array type dynamically. 2002-05-02 20:09:59 +00:00
Neil Schemenauer aa769ae468 PyObject_Del can now be used as a function designator. 2002-04-12 02:44:10 +00:00
Fred Drake f4e3484692 Use the PyModule_*() API instead of manipulating the module dictionary
directly.
2002-04-01 03:45:06 +00:00
Martin v. Löwis aa158be623 Remove tp_print. 2002-03-04 09:38:52 +00:00
Martin v. Löwis 9986633609 Patch 520694: arraymodule.c improvements:
- make array.array a type
- add Py_UNICODE arrays
- support +=, *=
2002-03-01 10:27:01 +00:00
Guido van Rossum 146483964e Patch supplied by Burton Radons for his own SF bug #487390: Modifying
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-12-08 18:02:58 +00:00
Tim Peters 885d457709 sprintf -> PyOS_snprintf in some "obviously safe" cases.
Also changed <>-style #includes to ""-style in some places where the
former didn't make sense.
2001-11-28 20:27:42 +00:00
Guido van Rossum 702d08ec05 Fix buffer_info() docstring to match reality. See SF bug #444842. 2001-07-27 16:05:32 +00:00
Tim Peters b870c75253 Make it possible to find the use of tp_as_buffer here with a global search.
(Just a change to a comment)
2001-06-05 04:43:26 +00:00
Guido van Rossum 2b597e4f54 Correct one-line typo, reported by yole @ SF, bug 130077. 2001-01-25 22:12:43 +00:00
Guido van Rossum 05bbb9a8fb The array type was missing the Py_TPFLAGS_DEFAULT initializer for the
tp_flags.  This will become important when I introduce
Py_TPFLAGS_HAVE_RICHCOMPARE (as I should have!).
2001-01-24 21:44:21 +00:00
Guido van Rossum 9d19cb8a70 Same treatment as listobject.c:
- 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.
2001-01-18 01:02:55 +00:00
Tim Peters 7c1cb46126 Fix for SF bug 117402, crashes on str(array) and repr(array). This was an
unfortunate consequence of somebody switching from PyArg_Parse to
PyArg_ParseTuple but without changing the argument from a NULL to a tuple.
2000-11-10 19:04:19 +00:00
Fred Drake d5fadf75e4 Rationalize use of limits.h, moving the inclusion to Python.h.
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-26 05:46:01 +00:00
Tim Peters 077a11dd00 arraymodule: Fix SF bug 113960.
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-16 22:31:29 +00:00
Tim Peters bb307343e4 General cleanup in preparation for a bugfix: removed unused code, useless
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-10 05:22:54 +00:00
Guido van Rossum 8586991099 REMOVED all CWI, CNRI and BeOpen copyright markings.
This should match the situation in the 1.6b1 tree.
2000-09-01 23:29:29 +00:00
Fred Drake 8ce159aef5 Peter Schneider-Kamp <nowonder@nowonder.de>:
Remove some of GCC's warning in -Wstrict-prototypes mode.

This closes SourceForge patch #101342.
2000-08-31 05:18:54 +00:00
Trent Mick 6c116dd56b Use safer comparisons (only matters when sizeof(int) != sizeof(size_t)). fread
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-12 20:58:11 +00:00
Tim Peters 329e29198d Removed decl of unreferenced vrbl. 2000-08-01 21:00:58 +00:00
Peter Schneider-Kamp dc71cacc9c replaced PyArgs_Parse by PyArgs_ParseTuple
changed error messages for extend method from "append" to "extend"
2000-07-31 21:57:30 +00:00
Peter Schneider-Kamp 5a65c2d436 added count, extend, index, pop and remove to arraymodule 2000-07-31 20:52:21 +00:00
Thomas Wouters f3f33dcf03 Bunch of minor ANSIfications: 'void initfunc()' -> 'void initfunc(void)',
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-21 06:00:07 +00:00
Peter Schneider-Kamp 9656abd913 ANSI-fication (got lost in the deep seas of source forge <wink>) 2000-07-13 21:10:57 +00:00
Tim Peters dbd9ba6a6c Nuke all remaining occurrences of Py_PROTO and Py_FPROTO. 2000-07-09 03:09:57 +00:00
Guido van Rossum db67739d4f Jack Jansen, Mac patch:
Include limits.h if we have it.
2000-07-01 01:09:43 +00:00
Guido van Rossum 9f754e0e2d In b_setitem(), instead of the platform dependent CHAR_MIN and
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-07-01 00:38:19 +00:00
Guido van Rossum ffcc3813d8 Change copyright notice - 2nd try. 2000-06-30 23:58:06 +00:00
Guido van Rossum fd71b9e9d4 Change copyright notice. 2000-06-30 23:50:40 +00:00
Guido van Rossum 7d0ae5e14e Trent Mick: use size_t instead of int where appropriate (in
fromfile(), to hold fread() result.)
2000-06-28 21:27:21 +00:00
Fred Drake 541dc3b7b2 Trent Mick <trentm@activestate.com>:
The cause: Relatively recent (last month) patches to getargs.c added
overflow checking to the PyArg_Parse*() integral formatters thereby
restricting 'b' to unsigned char value and 'h','i', and 'l' to signed
integral values (i.e. if the incoming value is outside of the
specified bounds you get an OverflowError, previous it silently
overflowed).

The problem: This broke the array module (as Fredrik pointed out)
because *its* formatters relied on the loose allowance of signed and
unsigned ranges being able to pass through PyArg_Parse*()'s
formatters.

The fix: This patch fixes the array module to work with the more
strict bounds checking now in PyArg_Parse*().

How: If the type signature of a formatter in the arraymodule exactly
matches one in PyArg_Parse*(), then use that directly. If there is no
equivalent type signature in PyArg_Parse*() (e.g. there is no unsigned
int formatter in PyArg_Parse*()), then use the next one up and do some
extra bounds checking in the array module.

This partially closes SourceForge patch #100506.
2000-06-28 17:49:30 +00:00
Fred Drake 137507ea03 Michael Hudson <mwh21@cam.ac.uk>:
Removed PyErr_BadArgument() calls and replaced them with more useful
error messages.
2000-06-01 02:02:46 +00:00
Guido van Rossum b18618dab7 Vladimir Marangozov's long-awaited malloc restructuring.
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.)
2000-05-03 23:44:39 +00:00
Fred Drake 0d40ba4cdf Patch from Paul Sokolovsky <Paul.Sokolovsky@technologist.com>:
Attached is patch (against 1.5.2 release) to allow some modules
to be buildable as pyd's (usual &PyType_Type stuff).
2000-02-04 20:33:49 +00:00
Guido van Rossum bffd683f73 The rest of the changes by Trent Mick and Dale Nagata for warning-free
compilation on NT Alpha.  Mostly added casts etc.
2000-01-20 22:32:56 +00:00
Fred Drake bf27298364 Correct the docstring for byteswap(); error noted by Bernhard Reiter
<bernhard@uwm.edu>.

Added a check that no parameters were passed to byteswap(); previously
allowed any parameters you happened to pass.
1999-12-03 17:15:30 +00:00
Guido van Rossum 7f1de832a2 Tiny patch by Mark Hammond to avoid sys/types.h if we don't have it
(for Windows/CE).
1999-08-27 20:33:52 +00:00
Guido van Rossum 481ac8811e Use an unsigned cast to avoid a warning in VC++. 1999-03-19 21:50:11 +00:00
Guido van Rossum 3791b0de36 Carefully check for overflow when allocating the memory for fromfile
-- someone tried to pass in sys.maxint and got bitten by the bogus
calculations.
1999-02-23 18:05:22 +00:00
Guido van Rossum 3886bb6997 Add DL_EXPORT() to all modules that could possibly be used
on BeOS or Windows.
1998-12-04 18:50:17 +00:00
Guido van Rossum a0deb64024 No need to issue a fatal error if the PyDict_SetItemString fails; the
caller (in import.c) will test for errors and take appropriate action.
1998-10-14 13:45:06 +00:00
Guido van Rossum fc6aba5008 ACK! There was still an unescaped newline in a docstring. 1998-10-14 02:52:31 +00:00