Commit Graph

804 Commits

Author SHA1 Message Date
Guido van Rossum 2f4caa4c48 cPickle, version 0.1. 1997-01-06 22:59:08 +00:00
Guido van Rossum 55702f8d6a Jim's latest version. 1997-01-06 22:57:52 +00:00
Barry Warsaw d4ff1b908b New strop_joinfields implementation, highly optimized for Lists. All
other sequences use the Sequence protocol from the abstract API.  The
algorithm has changed so that only one pass through the sequences are
made.
1997-01-06 22:48:32 +00:00
Guido van Rossum e0548b8da7 Rewrote translate() as follows:
- 'delete' is a C++ keyword; use 'del_table' instead
	- apply Py_CHARMASK() to del_table[i] before using it as an index
	  *** this fixes a bug that was just reported on the list ***
	- if the translation didn't make any changes, INCREF and return
	  the original string
	- when del_table is empty or omitted, don't copy the translation
	  table to a table of ints (should be a bit faster)

Rewrote maketrans() to avoid copying the table (2-3% faster).
1997-01-06 16:50:09 +00:00
Barry Warsaw 04d2d15b6b strop_upper(), strop_lower(): shared code version caused to much of a
performance hit.  Urg.  Reverted.

strop_joinfields(): re-instate optimizations for lists and tuples, but
support arbitrary other kinds of sequences as well.
1997-01-03 23:46:51 +00:00
Roger E. Masse bf0c3ca9bd Renamed but not well tested. 1997-01-03 23:00:51 +00:00
Barry Warsaw e8fc29cde7 Several changes:
- split_whitespace(): slightly better memory ref handling when errors
  occur.

- strop_joinfields(): First argument can now be any sequence-protocol
  conformant object.

- strop_find(), strop_rfind(): Use PyArg_ParseTuple for optional
  arguments

- strop_lower(), strop_upper(): Factor logic into a common function
  do_casechange().

- strop_atoi(), strop_atol(): Use PyArg_ParseTuple.

- strop_maketrans(): arguments used to be optional, although the
  documentation doesn't reflect this.  Make the source conform to the
  docs.  Arguments are required, but two empty strings will return the
  identity translation table.

- General pass fixing up formatting, and checking for return values.
1997-01-03 22:45:34 +00:00
Roger E. Masse a2a8b27221 Renamed, but not throughly tested. 1997-01-03 22:40:34 +00:00
Roger E. Masse 7ba4c07768 Renamed, but untested. 1997-01-03 22:17:11 +00:00
Guido van Rossum 9bc7e0af50 Added PyLong*UnsignedLong and PyCobject interfaces. 1997-01-03 21:05:44 +00:00
Roger E. Masse eaa6e1102f Renamed, reindented. (was already partially complete) 1997-01-03 19:26:27 +00:00
Guido van Rossum 549ab711aa Add new formats B, H, I, L for unsigned data types (analogous to the
recent changes in the struct module).
1997-01-03 19:09:47 +00:00
Guido van Rossum 6c87ecaff1 Changed the ``add/sub_offset'' hacks for dealing with C's unsigned
int/long types, and use the new PyLong_FromUnsignedLong() and
PyLong_AsUnsignedLong() interfaces instead.

Semantic change: the 'I' format will now always return a long int.
1997-01-03 19:08:16 +00:00
Roger E. Masse 5b0eba3ced Reindented. 1997-01-03 18:51:01 +00:00
Barry Warsaw 752300bbdf Check of return values and proper error handling. 1997-01-03 17:18:10 +00:00
Guido van Rossum b9d338cbfb Fill pad bytes with zeros (fixing a bug dating from the very first version!). 1997-01-03 15:40:33 +00:00
Barry Warsaw b9a781e177 Scratch the ears of gcc -Wall. 1997-01-03 00:26:28 +00:00
Barry Warsaw 929711765e Several changes:
- Conform to standard Python C coding styles.

- All static symbols were renamed and shorted.

- Eyeballed all return values and memory references.

- Fixed a bug in signal.pause() so that exceptions raised in signal
  handlers are now properly caught after pause() returns.

- Removed SIGCPU and SIGFSZ.  We surmise that these were typos for the
  previously missing SIGXCPU and SIGXFSZ.
1997-01-03 00:14:25 +00:00
Guido van Rossum 4ccc531f34 Ok, ok, I've fixed gradual underflow on packing too.
Still don't know what to do with Inf/NaN, so I raise an exception on
pack(), and something random decided by ldexp() will happen on
unpack().
1997-01-02 23:23:20 +00:00
Guido van Rossum 07ef655222 Oops -- unpack float/double didn't do the right thing if e==0. 1997-01-02 22:31:07 +00:00
Guido van Rossum 74679b455f Support float and double in non-native formats.
These use the ANSI/IEEE standard, which is also used by XDR;
so the _xdr module may become obsolete.
1997-01-02 22:21:36 +00:00
Barry Warsaw 9e3fceb5b3 rotorobj_setkey(): A single string argument is now required (i.e. no
long optional with nearly-no-op missing).
1997-01-02 20:36:36 +00:00
Guido van Rossum 60c50614e1 Added better handling of unsigned longs -- a Python long returned by
unpack('L', ...) is now acceptable to pack('L', ...).
1996-12-31 16:29:52 +00:00
Guido van Rossum 3aa27fd315 Fix the first bugs... treatment of 0 count was wrong, and memchr()
should be memset().
1996-12-31 02:10:45 +00:00
Guido van Rossum f7e6b4b388 Pretty much rewritten to fulfull several long-standing wishes:
-- The whole implementation is now more table-driven.

-- Unsigned integers.  Format characters 'B', 'H', 'I' and 'L'
mean unsigned byte, short, int and long.  For 'I' and 'L', the return
value is a Python long integer if a Python plain integer can't
represent the required range (note: this is dependent on the size of
the relevant C types only, not of the sign of the actual value).

-- A new format character 's' packs/unpacks a string.  When given a
count prefix, this is the size of the string, not a repeat count like
for the other format characters; e.g. '10s' means a single 10-byte
string, while '10c' means 10 characters.  For packing, the string is
truncated or padded with null bytes as appropriate to make it fit.
For unpacking, the resulting string always has exactly the specified
number of bytes.  As a special case, '0s' means a single, empty
string (while '0c' means 0 characters).

-- Various byte order options.  The first character of the format
string determines the byte order, size and alignment, as follows:

First character		Byte order		size and alignment

	'@'		native			native
	'='		native			standard
	'<'		little-endian		standard
	'>'		big-endian		standard
	'!'		network (= big-endian)	standard

If the first character is not one of these, '@' is assumed.

Native byte order is big-endian or little-endian, depending on the
host system (e.g. Motorola and Sun are big-endian; Intel and DEC are
little-endian).

Native size and alignment are determined using the C compiler's sizeof
expression.  This is always combined with native byte order.

Standard size and alignment are as follows: no alignment is required
for any type (so you have to use pad bytes); short is 2 bytes; int and
long are 4 bytes.  In this mode, there is no support for float and
double.

Note the difference between '@' and '=': both use native byte order,
but the size and alignment of the latter is standardized.

The form '!' is available for those poor souls who can't remember
whether network byte order is big-endian or little-endian.

There is no way to indicate non-native byte order (i.e. force
byte-swapping); use the appropriate choice of '<' or '>'.
1996-12-31 01:41:25 +00:00
Roger E. Masse fbd1d74286 Renamed.
However: "cgensupport.h" is still present... otherwise I get
	maaaany type errors... not sure if this needs more attention.
1996-12-24 19:39:23 +00:00
Barry Warsaw aeb207c6b6 Reworked to check for memory problems (one potential found),
non-checked error return values, and where appropriate,
PyArg_ParseTuple() style argument parsing.

I also changed some function names and converted all malloc/free calls
to PyMem_NEW/PyMem_DEL.

Some stylistic changes and formatting standardization.
1996-12-23 23:36:24 +00:00
Roger E. Masse 7f33e403a4 Renamed. 1996-12-20 21:56:08 +00:00
Barry Warsaw c357325663 Several changes. Test program to follow.
- Where optional arguments were being used, converted to
  PyArg_ParseTuple() style instead of nested PyArg_Parse() style.

- Check for and handle many potential error conditions that were never
  being tested.

- internal reg_* functions renamed to regobj_* (makes it easier to
  figure out which are global regex functions and which are for regex
  objects).

- reg_group (now regobj_group) was quite extensively reworked.  it no
  longer recurses to do its job (by factoring core functionality into
  a separate function that knows about string and integer indexes).

- some minor formatting fixes.

- regex_set_syntax() now invalidates the cache.  Without this change
  (in the example below), the second search would produce different
  output depending on whether the first search were performed or not
  (since performing the first search would cache the compiled object
  with RE_SYNTAX_EMACS, causing the second test to unexpectedly fail).

  regex.search('(a+)|(b+)', 'cdb')
  prev = regex.set_syntax(RE_SYNTAX_AWK)
  regex.search('(a+)|(b+)', 'cdb')
1996-12-20 21:56:07 +00:00
Roger E. Masse a141f8a31a Renamed. 1996-12-20 20:50:39 +00:00
Barry Warsaw 4a34209468 1. Export open(2) flag constants for every defined constant
2. Reworked error checking in initposix() and initnt().
1996-12-19 23:50:02 +00:00
Barry Warsaw bab218e420 Minor formatting changes. 1996-12-19 22:22:32 +00:00
Barry Warsaw 43d68b8fb0 Minor formatting changes. 1996-12-19 22:10:44 +00:00
Guido van Rossum 25405c786b Added the new getprotobyname() call to the module overview at the top. 1996-12-19 16:42:52 +00:00
Guido van Rossum 3901d85277 Added getprotobyname() interface. 1996-12-19 16:35:04 +00:00
Roger E. Masse 20c6381856 Removed references to getdoublearg and get2doublearg rename macros and
substituted the appropriate PyArg_Parse calls.  Retested.  All appears well.
1996-12-18 21:59:01 +00:00
Roger E. Masse ec0b4af3d4 Eradicated all references to getintarg and getstrarg and substituded the
proper functions as defined in rename2.h.  Thanks Barry!
1996-12-18 20:07:39 +00:00
Roger E. Masse cfe3b61c02 Opps, left out two defines needed for argument parsing. 1996-12-18 19:56:48 +00:00
Barry Warsaw 19f61ae196 Tabification changes only; the module was already newly named. 1996-12-18 19:50:00 +00:00
Roger E. Masse b2b44e5b8a Renamed. 1996-12-18 19:37:32 +00:00
Guido van Rossum 2e6313930e Added Jeremy's resource module. 1996-12-18 18:37:27 +00:00
Guido van Rossum 4a4880966b Correct *another* mistake (initmath() always fell through to fatal error).
Watch it, Barry! :-)
1996-12-18 14:14:33 +00:00
Guido van Rossum 4c4cbf397b Correct 1-char typo / syntax error. 1996-12-18 14:12:22 +00:00
Guido van Rossum c88c9cb23f Corrected two errors introduced by the renaming (and the subsequent
style corrections, I presume), found by Jack.  Added warning that this
has not been tested (Jack could only compile and link it).
1996-12-17 20:43:55 +00:00
Roger E. Masse b15bef85a7 Renamed in a grand-ee-ous way! 1996-12-17 19:55:33 +00:00
Roger E. Masse 4ca4b07516 Opps, left in a /*#include "modsupport.h"*/ 1996-12-17 17:46:28 +00:00
Roger E. Masse 919213a098 Grandly renamed. 1996-12-17 17:42:22 +00:00
Guido van Rossum 4004e21484 Another fix for Split() -- don't refuse {"} but turn it into ".
This is needed because if a configure option has " as its value,
it will be rendered as {"}; after stripping one level of quoting it's
just ", on which splitlist will barf.
1996-12-17 01:25:36 +00:00
Guido van Rossum 0f868375ff Check errors returned by recursive call to Split(). 1996-12-17 01:02:18 +00:00
Barry Warsaw fc93f75da7 Better error checking in initmath(). 1996-12-17 00:47:03 +00:00
Barry Warsaw d0c1042ff2 Renamed. 1996-12-17 00:05:22 +00:00
Barry Warsaw 10f124c951 Updated to standard Python C coding style, and fixed a few error
checking nits.
1996-12-17 00:01:40 +00:00
Barry Warsaw 14ed5fb1ec initsignal(): Added SIGXCPU and SIGXFSZ. Left in the definitions for
SIGCPU and SIGFSZ but we're (Jeremy and I) are actually unsure whether
these were typos or if there are systems that use these alternate
names.  We've checked Solaris, SunOS, and IRIX; they contain only the
SIGX* names.
1996-12-16 20:24:22 +00:00
Barry Warsaw 529fcfe31f list2set(): correct return value (an int, not a PyObject*). 1996-12-16 18:15:34 +00:00
Roger E. Masse 81a6fe9b98 Removed a #inlclude <errno.h> since it's implied with "Python.h" 1996-12-13 23:29:09 +00:00
Barry Warsaw 24c4b3d4e8 list2set(): PyList_GetItem could fail. 1996-12-13 23:22:42 +00:00
Roger E. Masse 0e12032748 Renamed. 1996-12-13 20:33:44 +00:00
Guido van Rossum 4e7f62229e Get rid of it -- use bsddb! 1996-12-13 16:24:06 +00:00
Roger E. Masse bd4b961a0d Opps, fixed a couple of newly introduced wrapping problems. 1996-12-13 15:59:22 +00:00
Roger E. Masse e7ee8c3753 Reindented via GvR recomendation ala Bwarsaw cppy-style.el 1996-12-13 15:55:22 +00:00
Guido van Rossum fbcfd52a9a Added the example "thin ice" from the extensions manual. 1996-12-13 02:57:25 +00:00
Barry Warsaw f630f6b93d Renamed, and scrutinized for missed potential error conditions.
Alas, I don't have an Indigo, so I could not even compile this.
1996-12-13 01:24:29 +00:00
Barry Warsaw 8496d39478 Renamed, however there is no test case. I did test some of the module
out manually, and it does compile, but I'm not sure how to write a
useful portable test case.  Maybe later...
1996-12-13 00:11:04 +00:00
Barry Warsaw 30695fa3cd Renamed. 1996-12-12 23:32:31 +00:00
Barry Warsaw c2feec3378 Renamed, but *not* tested or compiled. I don't even have the STDWIN
library.
1996-12-12 22:48:20 +00:00
Barry Warsaw c1cb360683 Reworked to eliminate all potential memory problems, including
deletion of object from list argument during callout to fileno().
1996-12-12 22:16:21 +00:00
Barry Warsaw e4ac0aa618 Several changes... Guido *please* take a look!
1. Renamed

2. Several coding styles were being used here, owing to the multiple
   contributors.  I tried to convert everything to standard "python"
   coding style for indentation, paren and brace placement, etc.

3. There were several potential error conditions that were never being
   checked, and where I saw them, I added checks of return values,
   etc.  I'm pretty sure I got them all.

4. There were some old-style (pre PyArg_ParseTuple) argument
   extraction and these were converted to use PyArg_ParseTuple.

All changes compile and run with the new test_select.py module, at
least on my Solaris/Sparc box.
1996-12-12 00:04:35 +00:00
Barry Warsaw 7bd9fbdea2 Grandly renamed.
Note that since I have no idea how to test this, I didn't write a test
case.  It does seem to at least compile on my system though.
1996-12-11 21:33:16 +00:00
Barry Warsaw 50c5cf132a Renamed. 1996-12-11 16:54:40 +00:00
Barry Warsaw 1abda0fb12 cat and puste errors 1996-12-11 01:00:46 +00:00
Barry Warsaw 3696c524a4 nis_maplist(): Use check of yp_get_default_domain() return value
that's used in other parts of this module.

nis_maps(): use PyArg_NoArgs().
1996-12-11 00:29:14 +00:00
Barry Warsaw adbf4e66df Renamed, and bug fixed:
Two interesting problems in nis_maplist().  First, it is possible that
clnt_create() will return NULL.  This was being caught, but no Python
error was being set.  I use clnt_spcreateerror() to generate the value
of the exception.

But why would clnt_create() fail?  It's because no server was being
found.  And why was this?  It was because nis_maplist() tried only to
get the NIS master for the first map in the aliases list, which is
passwd.byname, and guess what?  That's the one NIS map CNRI does *not*
export!  So the yp_master() call was failing to return a valid
server.  I now cycle through all the map aliases until I find a valid
master.  If not, a different exception is set.

I'm not sure this is the completely correct way to do all this, but
short of rewriting the entire nismodule.c (to expose the proper API to
Python), it should do the trick.
1996-12-11 00:15:58 +00:00
Barry Warsaw 53699e9ec1 Renamed.
Note that there is no test suite for this module, and I don't plan to
write one just now.
1996-12-10 23:23:01 +00:00
Barry Warsaw a6b7c7146c Renamed. 1996-12-10 16:25:56 +00:00
Guido van Rossum caf783793d Added remaining declarations needed/used in glmodule.c; keeps gcc -Wall happy. 1996-12-10 15:41:19 +00:00
Guido van Rossum 36dd0d27c4 Fix operator priority bug found thanks to gcc -Wall. 1996-12-10 15:23:00 +00:00
Guido van Rossum e29ed8fa7c Make gcc -Wall happy; remove dummy variable (can't see where it's needed). 1996-12-10 15:21:30 +00:00
Guido van Rossum fb4130d1f1 Added extern decl for gethostname() to keep gcc -Wall happy. 1996-12-10 15:17:08 +00:00
Guido van Rossum 55db515a51 Great renaming.
Also got rid of the dummy variable, which was last needed in IRIX 4.x.
1996-12-10 00:32:31 +00:00
Guido van Rossum 09f99dfdba Removed redundant inclusion of <errno.h> (sorry, Roj!). 1996-12-10 00:12:14 +00:00
Roger E. Masse b0dfe969d9 renamed in a grand fashion. 1996-12-10 00:07:00 +00:00
Barry Warsaw abb7efeb7c Renamed a few symbols that were found in comments. 1996-12-09 23:22:35 +00:00
Barry Warsaw 3bdf746c5c Renamed, ungrandly. We don't have the GNU MP library here so we can't
really test this module, or even compile it without a lot of work.

I'll make a note of it that this has not been tested!
1996-12-09 23:16:31 +00:00
Roger E. Masse 56c345b235 renamed grandly. 1996-12-09 23:14:26 +00:00
Roger E. Masse 24070ca391 Renamed Grandly 1996-12-09 22:59:53 +00:00
Barry Warsaw 8b43b19ec9 Renamed 1996-12-09 22:32:36 +00:00
Roger E. Masse 5817f8f717 Removed some unneeded header files and reedited with a fixed-width font
from emacs as per recomendation from GvR
1996-12-09 22:24:19 +00:00
Roger E. Masse 2919eaaf08 Renamed Grandly (I think). 1996-12-09 20:10:36 +00:00
Guido van Rossum ece35bc22f Changes to keep gcc -Wall happy. 1996-12-09 18:52:11 +00:00
Guido van Rossum 7ce52be627 Added `void' to declaration of initgl(), to keep gcc -Wall happy. 1996-12-09 18:51:51 +00:00
Guido van Rossum 665f9198fe Added a bunch of extern void decls, to keep gcc -Wall happy. 1996-12-09 18:49:42 +00:00
Guido van Rossum 3d65fa3488 Include <sys/ioctl.h>, to keep gcc -Wall happy. 1996-12-09 18:49:14 +00:00
Guido van Rossum cd165cc092 Make dummy int public (with _Py_ prefix), to keep gcc -Wall happy. 1996-12-09 18:48:32 +00:00
Guido van Rossum 37273177be Add ``extern void bzero();'' for SGI, to keep gcc -Wall happy. 1996-12-09 18:47:43 +00:00
Guido van Rossum 66a7013c5c Include unistd.h to keep gcc -Wall happy. 1996-12-09 18:46:58 +00:00
Guido van Rossum 259552dbd9 Added ``extern int get_default_domain();'' for SGI, to keep gcc -Wall happy. 1996-12-09 18:46:28 +00:00
Guido van Rossum 52174577eb Added #ifdef around ``extern int ftime();'' for MS WINDOWS (which has
a conflicting definition somewhere).
Resolved line wrap for error message in ins().
1996-12-09 18:38:52 +00:00
Barry Warsaw f52560197f Greatly renamed. 1996-12-09 18:35:56 +00:00
Barry Warsaw ec775c52a2 ins(): missed a renaming in a string: dictinsert =>
PyDict_SetItemString.

GvR: note the long line > 80 chars.  Wrapping suggestions?
1996-12-09 18:24:35 +00:00
Barry Warsaw 9a2a8a8d31 Greatly renamed. 1996-12-06 23:32:14 +00:00