the Python Unicode implementation.
The internal buffer used for implementing the buffer protocol
is renamed to defenc to make this change visible. It now holds the
default encoded version of the Unicode object and is calculated
on demand (NULL otherwise).
Since the default encoding defaults to ASCII, this will mean that
Unicode objects which hold non-ASCII characters will no longer
work on C APIs using the "s" or "t" parser markers. C APIs must now
explicitly provide Unicode support via the "u", "U" or "es"/"es#"
parser markers in order to work with non-ASCII Unicode strings.
(Note: this patch will also have to be applied to the 1.6 branch
of the CVS tree.)
Montanaro, handle execution of indented regions by inserting an "if
1:" in front of the block. This better preserves things like triple
quoted strings and commented regions. This patch resolves PR#264.
1.5.2 was released, except those who contributed only to Doc files --
Fred has his own way of doing this.
This doesn't mean that I've got everyone who contributed *before*
1.5.2 was released in here... :-(
executive summary:
Instead of typing 'apply(f, args, kwargs)' you can type 'f(*arg, **kwargs)'.
Some file-by-file details follow.
Grammar/Grammar:
simplify varargslist, replacing '*' '*' with '**'
add * & ** options to arglist
Include/opcode.h & Lib/dis.py:
define three new opcodes
CALL_FUNCTION_VAR
CALL_FUNCTION_KW
CALL_FUNCTION_VAR_KW
Python/ceval.c:
extend TypeError "keyword parameter redefined" message to include
the name of the offending keyword
reindent CALL_FUNCTION using four spaces
add handling of sequences and dictionaries using extend calls
fix function import_from to use PyErr_Format
The attached patch set includes a workaround to get Python with
Unicode compile on BSDI 4.x (courtesy Thomas Wouters; the cause
is a bug in the BSDI wchar.h header file) and Python interfaces
for the MBCS codec donated by Mark Hammond.
Also included are some minor corrections w/r to the docs of
the new "es" and "es#" parser markers (use PyMem_Free() instead
of free(); thanks to Mark Hammond for finding these).
The unicodedata tests are now in a separate file
(test_unicodedata.py) to avoid problems if the module cannot
be found.
Attached you find the latest update of the Unicode implementation.
The patch is against the current CVS version.
It includes the fix I posted yesterday for the core dump problem
in codecs.c (was introduced by my previous patch set -- sorry),
adds more tests for the codecs and two new parser markers
"es" and "es#".
Attached you find an update of the Unicode implementation.
The patch is against the current CVS version. I would appreciate
if someone with CVS checkin permissions could check the changes
in.
The patch contains all bugs and patches sent this week and also
fixes a leak in the codecs code and a bug in the free list code
for Unicode objects (which only shows up when compiling Python
with Py_DEBUG; thanks to MarkH for spotting this one).
(python): Set defgroup :prefix to "py-" to make variable names cleaner.
(py-jpython-command, py-jpython-command-args): Set :tag for proper
capitalization of JPython in variable name display.
first time a py buffer is visited during the Emacs session. This
ensures that py-which-shells is initialized and also guarantees that
the mode lines reflect the correct shell. First bug found by GvR,
second one has long bugged :) me.
(py-toggle-shells): Programmatically, arg can also take the symbols
`cpython' or `jpython', which makes it easy to call with the value of
py-default-interpreter.
(py-shell): Don't need to initialize py-which-* variables since these
will guarantee to be initialized by python-mode when the first py
buffer is visited.
(py-default-interpreter): Update docstring.
casing when py-honor-comment-indentation is nil, but this could be a
religious issue with some. Seems to me we should still be dedenting
such comment lines one level.
buffer-syntactic-context -- just short circuit the TQS test by jumping
to point-min and doing the test from there. For long files, this will
be faster than looping with a re-search-backwards.
I don't know what its origins are but I think I've seen it
once in a NeXT dictionary application -- not sure whether
anyone owns copyright but I don't see why we should risk it.
py-newline-and-indent. These ought to get picked up by the mapcar
that follows; any existing binding to newline-and-indent gets shadowed
to py-newline-and-indent.
This will break some people who, e.g. bind C-m or C-j to newline but
still want these bound to py-newline-and-indent in Python mode. On
the other hand, the forced binding pisses off Emacs diehards. So
consider this experimental and see if any tall Dutch guys complain :-)
standard narrow-to-defun but works with Python classes and methods.
With no arg, narrows to most enclosing def/method. With C-u arg,
narrows to most enclosing class.
string we find ourselves in, based on the passed in delimiter.
(py-compute-indentation): Fixes for indentation errors when we land
inside a triple quoted string. For example:
def foo():
if os.path.isfile(o_pri_mbox_file) and os.path.isfile(o_pub_mbox_file):
print """\
I found both a private and a public mbox archive file
private: %s
public : %s
I won't move either file, but you should choose one and move it to
%s
You may want to merge them manually, but be careful about exposing private
correspondences to the public.""" % (
o_pri_mbox_file, o_pub_mbox_file, mbox_file)
*----indentation would be wrong on this line.
#simple things. First step: rename the Imenu supportive variables and
#functions in this file to py-imenu-* so I can grok what is part of
#python-mode and what is part of Imenu.
(py-imenu-create-index-engine): Fixed problem with two classes in a
single file, caused by new semantics of py-beginning-of-def-or-class
when called programmatically.
#Note, there are still some problems with Imenu when arguments to
#functions are funky, but it should be much better now.