Patch #1011890: fix inspect.getsource breaking with line-continuation &
more. Thanks to Simon Percivall!
The patch makes changes to inspect.py in two places:
* the pattern to match against functions at line 436 is
modified: lambdas should be matched even if not
preceded by whitespace, as long as "lambda" isn't part
of another word.
* the BlockFinder class is heavily modified. Changes are:
- checking for "def", "class" or "lambda" names
before setting self.started to True. Then checking the
same line for word characters after the colon (if the
colon is on that line). If so, and the line does not
end with a line continuation marker, raise EndOfBlock
immediately.
- adding self.passline to show that the line is to be
included and no more checking is necessary on that
line. Since a NEWLINE token is not generated when a
line continuation marker exists, this allows getsource
to continue with these functions even if the following
line would not be indented.
Also add a bunch of
'quite-unlikely-to-occur-in-real-life-but-working-anyway' tests.
Patch #736962: port test_inspect to unittest. As part of this, move out
the fodder modules to separate files to get rid of the imp.load_source()
trickery.
locale.py now uses an updated locale alias table (built using
Tools/i18n/makelocalealias.py, a tool to parse the X11 locale
alias file); the encoding lookup was enhanced to use Python's
encoding alias table
As sige-effect, this fixes SF bug [ 1080864 ] locale.py doesn't recognize
valid locale setting.
Brett Cannon [Tue, 7 Dec 2004 03:25:18 +0000 (03:25 +0000)]
Change code in setup.py for parsing LDFLAGS and CPPFLAGS to use optparse
instead of getopt. Required making use of gettext._ as optional (optparse
changed OK'ed by Greg Ward in private email).
Brett Cannon [Tue, 7 Dec 2004 00:42:59 +0000 (00:42 +0000)]
setup.py now uses the library directories specified in LDFLAGS (``-L``
directories) and the include directories specified in CPPFLAGS (``-I``
directories) for compiling the extension modules.
This has led to the core being compiled with the values in the shell's
CPPFLAGS. It has also removed the need for special casing to use Fink and
DarwinPorts under darwin since the needed directories can now be specified in
LDFLAGS and CPPFLAGS (e.g., DarwinPorts users can now do
``LDFLAGS=-L/opt/local/lib; CPPFLAGS=-I/opt/local/include; ./configure`` for
everything to work properly).
Parsing the values in the environment variables is done with getopt. While optparse
would have been a nicer solution it cannot be used because of dependency issues
at execution time; optparse uses gettext which uses struct which will not have
been compiled when the code is imported. If optparse ever makes its
importation of gettext optional by catching ImportError and setting _() to an
identity function then it can be used.
smtplib can not log in to some server using command AUTH PLAIN, it sends
``user\0user\0pass'' to the server, but ``\0user\0pass'' has better
compatibility.
Brett Cannon [Mon, 6 Dec 2004 06:08:59 +0000 (06:08 +0000)]
Have test_mkalias_relative check that sys.prefix already exists; otherwise test
is pointless.
Also add a note to the docs for the 'test' package that test cases should check
first that any conditions needed in the operating system are met before having
a test run.
Barry Warsaw [Sun, 5 Dec 2004 03:45:42 +0000 (03:45 +0000)]
Fixes for SF #1076485, which I'll apply to the CVS head too. The problem was
caused by a self._input.readline() call that wasn't checking for the
NeedsMoreData marker.
msg_43.txt contains a message that illustrates the problem, when
email.message_from_*() is called. That interface uses the Parser API, which
splits reads into 8192 byte chunks. It so happens that for the test message,
the 8192 chunk falls inside a message/delivery-status, which is where in the
FeedParser the readline() call was that didn't check for NeedsMoreData.
I also added an assert to unreadline() so it'll be more evident if an attempt
to push back NeedsMoreData ever happens again.
Thomas Heller [Wed, 1 Dec 2004 18:18:08 +0000 (18:18 +0000)]
Running the pre-install or post-install script did not work when
Python was installed with the 'only for me' option. The registry key
had a hardcoded '2.3' in it where the python version chosen for
installation should be used instead.
Fred Drake [Wed, 1 Dec 2004 06:30:31 +0000 (06:30 +0000)]
- fix up internal hyperlink generation in PDF formatting so that links at
the beginning of a paragraph do not generate errors; this affected
things like \refmodule when it came first in a paragraph
- clean up the .sty file to separate out the treatment of the start
of a new paragraph
Fred Drake [Wed, 1 Dec 2004 05:55:47 +0000 (05:55 +0000)]
- bump version number for "What's New" document
- don't create .tgz version of doc source package, since we're not
generating that for the other formats either
Barry Warsaw [Sun, 28 Nov 2004 00:21:42 +0000 (00:21 +0000)]
Fix for SF bug #1072623. When the last line of the input string does not end
in a newline, and it's an end boundary, the FeedParser wasn't recognizing it
as such. Tweak the regexp to make the ending linesep optional.
For grins, clear self._partial when closing the BufferedSubFile.
Hye-Shik Chang [Thu, 25 Nov 2004 04:04:20 +0000 (04:04 +0000)]
Rename a static variable "history_length" to "_history_length".
GNU readline exports a global variable that has such a name already
and the collision makes gcc4 doesn't compile the source.