Ahlstrom:
Arraymodule.c has static functions H_getitem and h_getitem, and a
few others which differ only in case. These are a problem on
Windows 3.1, since a case-sensitive link causes Winsock to fail
(hey, it's not my fault). Please convert H_etc to HH_etc etc.
otherwise laudible attempt to rationalize the argument parsing): it
would save a copy of the original string instead of a reference to it.
Go back to saving a reference, but keep the "s#" format (using a hack
that involves two argument parsing steps, first using "O", then using
"s#").
cgen.py. Now that cgen.py and cstubs have been quickly renamed, check
in the actual output. This has some "old-style" names left in
(getilongarg etc.) but these are now take care of by macros in
cgensupport.h (which is now specific to glmodule.c).
This used to be done whenever stdin was interactive. Now we only do
it when the -i flag is given. Also (and this is the real reason for
this fix) we explicitly allocate a buffer -- this seems to be
necessary on Windows.
string_append(). These must be artifacts of GvR's rewrite.
Fixed some typos in the leading comment (and re-filled the
paragraphs).
Hope you don't mind, Guido.
This completes the getpath.c checkin. Note that to enable this in an
existing build tree, you'll have to edit your Setup and Setup.in file
to remove the $(DESTLIB) from all the PATH variable definitions.
Idea and first three implementation rounds due to Barry -- after that
I spent another day on it, hopefully it's enough for now :-)
(Wait for the checkin to Setup.in.)
even if it isn't. Changes:
- set the global flag Py_InteractiveFlag when -i is given
- call Py_FdIsInteractive() instead of isatty()
- make stdin unbuffered, too, when using -u
- make stdin and stdout line buffered, when stdin is interactive and not -u
Note that setting the environment variable PYTHONINSPECT does not have
these extra effects of -i. (Should it?)
Unlike Lee's changes, I don't set change the prompt to go to stderr
when -i is given.
initparser()) instead of statically (in the initializer). The static
initialization, using the address of an object in a different DLL, is
too much for the Microsoft VC++ compiler, and we want to be able to
build this module as a separate DLL (it's nice to have but we don't
want to increase the core DLL's size by 25K). This same trick has
been applied to a number of modules, e.g. NumPy and _tkinter.
to Python. Minimal documentation is included in comments at the top
of the file, and in the Misc/PURIFY.README file. Note that this
module must be statically linked since Pure doesn't provide shared
stubs libraries.
(Setup.in): Added commented template for pure module
(syslogmodule.c): ins() function wasn't declared static.
unsigned. This fixes the 8bit-char-in-key platform incompatibility.
I also removed the old backwards compatibility code, and the commented
lisp rotor code. I retained the lisp docstrings as comments preceding
each function.
- Quieted gcc -Wall by removing unused local variables.
- Added some choice parentheses around assignments in conditional
tests.
- Removed an unused (and seemingly unreachable) err label in
load_short_binstring().
- in Unpickler_load(), removed \. in string format.
- init_stuff() was declared to return an int, but had these
problems:
- it was returning NULL instead of 0 or 1 in some cases
- it was falling of the end of the routine without returning
anything
- the call of init_stuff() in initcPickle() was never checking
the return value anyway.
I changed all this by returning 1 in the case of errors, 0 when
no error occurred. Then in initcPickle(), if init_stuff()
returns non-zero, I call Py_FatalError().
Suppressing my urge to reformat according to Python coding standards!
:-)
- '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).
performance hit. Urg. Reverted.
strop_joinfields(): re-instate optimizations for lists and tuples, but
support arbitrary other kinds of sequences as well.
- 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.
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.
- 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.
-- 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 '>'.
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.
- 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')