Commit Graph

29 Commits

Author SHA1 Message Date
Tim Peters 5de9842b34 Repair widespread misuse of _PyString_Resize. Since it's clear people
don't understand how this function works, also beefed up the docs.  The
most common usage error is of this form (often spread out across gotos):

	if (_PyString_Resize(&s, n) < 0) {
		Py_DECREF(s);
		s = NULL;
		goto outtahere;
	}

The error is that if _PyString_Resize runs out of memory, it automatically
decrefs the input string object s (which also deallocates it, since its
refcount must be 1 upon entry), and sets s to NULL.  So if the "if"
branch ever triggers, it's an error to call Py_DECREF(s):  s is already
NULL!  A correct way to write the above is the simpler (and intended)

	if (_PyString_Resize(&s, n) < 0)
		goto outtahere;

Bugfix candidate.
2002-04-27 18:44:32 +00:00
Neal Norwitz b0aaec5706 Convert more METH_OLDARGS & PyArg_Parse()
Please review.
2002-04-02 18:26:33 +00:00
Neal Norwitz 50905b557b Convert from using METH_OLDARGS to METH_NOARGS.
These should be safe.
2002-03-31 14:57:24 +00:00
Martin v. Löwis 43b936d08c Patch #477750: Use METH_ constants in Modules. 2002-01-17 23:15:58 +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
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
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
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 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
Guido van Rossum b189a2f997 lots of "goto error" replaced by "return" (Jack) 1997-10-08 15:26:28 +00:00
Guido van Rossum 0cb96de269 Apply two changes, systematically:
(1) Use PyErr_NewException("module.class", NULL, NULL) to create the
    exception object.

(2) Remove all calls to Py_FatalError(); instead, return or
    ignore the errors -- the import code now checks PyErr_Occurred()
    after calling a module's init function, so it's no longer a
    fatal error for the initialization to fail.

Also did some small cleanups, e.g. removed unnecessary test for
"already initialized" from initfpectl(), and unified
initposix()/initnt().

I haven't checked this very thoroughly, so while the changes are
pretty trivial -- beware of untested code!
1997-10-01 04:29:29 +00:00
Guido van Rossum 7242905385 Megapatch for IRIX 6 by Sjoerd. 1997-08-12 14:58:54 +00:00
Roger E. Masse e474fb36ab Renamed. 1997-01-17 16:00:02 +00:00
Guido van Rossum a376cc5cc8 Keep gcc -Wall happy. 1996-12-05 23:43:35 +00:00
Guido van Rossum d266eb460e New permission notice, includes CNRI. 1996-10-25 14:44:06 +00:00
Sjoerd Mullender 3db845b6f7 Make constants from cl.h include file available as module variables.
Also added Irix 5.3 constants.
1995-05-17 11:16:52 +00:00
Guido van Rossum 524b588553 Added 1995 to copyright message.
Setup.in: clarified Tk comments somewhat.
structmodule.c: use memcpy() instead of double precision assignment.
1995-01-04 19:10:35 +00:00
Guido van Rossum b6775db241 Merge alpha100 branch back to main trunk 1994-08-01 11:34:53 +00:00
Sjoerd Mullender f64992e95d * clmodule.c (doParams): free PVbuffer in error condition.
* frameobject.c (newframeobject): initialize ob_type if taking entry
  from the free list, since it is zeroed out when DEBUG is defined.
1993-08-03 15:11:36 +00:00
Guido van Rossum e537240c25 * Changed many files to use mkvalue() instead of newtupleobject().
* Fixcprt.py: added [-y file] option, do only files younger than file.
* modsupport.[ch]: added vmkvalue().
* intobject.c: use mkvalue().
* stringobject.c: added "formatstring"; renamed string* to string_*;
  ceval.c: call formatstring for string % value.
* longobject.c: close memory leak in divmod.
* parsetok.c: set result node to NULL when returning an error.
1993-03-16 12:15:04 +00:00
Sjoerd Mullender 22e44cd0b5 * clmodule.c: the documentation was wrong, so changed the interface
accordingly: SetMin, SetMax, SetDefault are no longer methods of the
  compressor/decompressor but are functions of the cl module and they
  take a first argument which is a compression scheme
1993-02-17 09:11:14 +00:00
Sjoerd Mullender 4e2a4278e8 * clmodule.c: use function prototypes (found and fixed some bugs this
way); more efficiently check whether parameters are float; removed
  one argument from DecompressImage method; use clGetParam instead of
  clGetParams where it makes sense; convert int parameters in
  SetParams, SetParam, SetMin, SetMax, and SetDefault to float when
  needed; added QuerySchemeFromHandle method
* Makefile: interchanged cstubs and cgen.py so that $> in rule gets
  them in the right order
1993-02-16 11:55:17 +00:00
Sjoerd Mullender 3a997279d5 CL.py, clmodule.c: Adapted to new CL library. Lots of new methods.
aifc.py: Several small improvements.  Use new methods from CL module.
1993-02-04 16:43:28 +00:00
Sjoerd Mullender 8dd054d918 adapted to newest version of CL library. 1992-12-14 13:17:29 +00:00
Sjoerd Mullender 384f24816b Lots of little fixes.
- merged CloseCompressor and CloseDecompressor into one function
- keep existing errors in error function (for exceptions raised in the
  Compress or Decompress callback functions)
- remove newline from error string generated by error function
- allocate less memory when compressing multiple frames
- keep existing errors when clCompress or clDecompress fails
- raise an exception when compressed data doesn't fit within
  dataMaxSize bytes
- allocate frameSize bytes for decompression buffer instead of
  dataMaxSize
- use mkvalue more often
- new function QueryParams which will accept CL.AUDIO and CL.VIDEO
  args
- changed some function names
1992-09-29 16:43:43 +00:00
Sjoerd Mullender 37f17b726c Fixed the last known bugs. 1992-09-25 10:28:20 +00:00
Sjoerd Mullender d53a4f3d14 New built-in module "cl" (Compression Library). Only for Irix 4.0.5
and higher.  Made a few improvements to previous version.
1992-09-24 10:37:39 +00:00
Sjoerd Mullender c431549e21 New built-in module cl, the Compression Library. 1992-09-23 14:53:00 +00:00