When an unhandled exception happens, report the repr() of the function
that was used to start the thread. This is useful to track down the
source of the problem when there is no traceback, as can happen when a
daemon thread gets to run after Python is finialized (a new kind of
event, somehow this is now possible due to changes in Py_Finalize()).
Regain throughput lost with the _socketobject wrapper. The
throughput-sensitive methods are grabbed from the underlying _socket.socket
object. Closes SF patch 729293.
SF bug #729096: getopt online documentation example improvement
A newbie found it difficult to translate the exampe into a
case that used only short options or long options but not both.
He tried to shorten the tuple search but forgot the trailing comma,
The appropriate pattern is an equality check.
Revised the example to point him in the right direction.
Raise a ValueError when there is data that was not covered in the format string. Done to match behavior of pre-existing C-based strptime implementations.
Tim Peters [Mon, 28 Apr 2003 03:13:03 +0000 (03:13 +0000)]
SF bug 728097: tmpnam problems on windows 2.3b, breaks test.test_os.
tmpnam() appears essentially useless on Windows, and it finally broke
the test for Irmen de Jong. Read the long new comment in test_tmpnam()
for details. Since the MS implementation is insane, it might be good
if we supplied a different implementation.
Make tests clean up after themselves better. This means:
* call tearDown when Setup is called
* shutil.rmtree the root of the created directory instead of just the leaf
directory
* set the LANGUAGE environment variable to what it was originally and not
assume 'en'.
- Included detailed documentation in _sre.c explaining how, when, and why
to use LASTMARK_SAVE()/LASTMARK_RESTORE(), based on the discussion
in patch #712900.
- Cleaned up LASTMARK_SAVE()/LASTMARK_RESTORE() usage, based on the
established rules.
- Moved the upper part of the just commited patch (relative to bug #725106)
to outside the for() loop of BRANCH OP. There's no need to mark_save()
in every loop iteration.
Fix for part of the problem mentioned in #725149 by Greg Chapman.
This problem is related to a wrong behavior from mark_save/restore(),
which don't restore the mark_stack_base before restoring the marks.
Greg's suggestion was to change the asserts, which happen to be
the only recursive ops that can continue the loop, but the problem would
happen to any operation with the same behavior. So, rather than
hardcoding this into asserts, I have changed mark_save/restore() to
always restore the stackbase before restoring the marks.
Both solutions should fix these two cases, presented by Greg:
Applied patch #725106, by Greg Chapman, fixing capturing groups
within repeats of alternatives. The only change to the original
patch was to convert the tests to the new test_re.py file.
Tim Peters [Sat, 26 Apr 2003 14:31:24 +0000 (14:31 +0000)]
Rewrote. As reported on c.l.py, when the test suite is run via
"import test.autotest", temp_imp failed because the import lock was
still held at the test's end (the test assumed it wouldn't be), and
then a RuntimeError got raised at the end of the entire suite run because
test_imp cleared the import lock as a side effect of trying to test that
the import lock wasn't held (but a legitimate import is in progress,
so the lock should be held, and the import machinery complained when it
found that the lock was unexpectedly cleareed).
Also removed the unittest scaffolding. It didn't buy anything here, and
the test was raising regrtest's TestFailed instead of using the unittest
failure-reporting mechanisms.
New feature: when saving a file, keep the eol convention of the
original. New files are written using the eol convention of the
platform, given by os.linesep. All files are read and written in
binary mode.
Skip testing inet_ntop() an inet_pton() if they aren't defined.
This makes the test pass on Windows again (and on other platforms
that don't have these).
Fix the tests on Windows, by writing the test data file in binary
mode.
XXX I'm not convinced that this is the right solution -- arguably,
on Windows, the _fileobject class should honor the mode argument
and do newline translation. But it's never done that so I think
there's no urgent need to fix this today.
Fred Drake [Fri, 25 Apr 2003 14:27:00 +0000 (14:27 +0000)]
Attempt to deal with some obvious errors in the code. These were all
due to using a single module-level namespace where multiple namespaces
were used before.
There *really* need to be tests for the sniffer stuff. This could
have been avoided.
Tim Peters [Fri, 25 Apr 2003 07:11:48 +0000 (07:11 +0000)]
New generator os.walk() does a bit more than os.path.walk() does, and
seems much easier to use. Code, docs, NEWS, and additions to test_os.py
(testing this sucker is a bitch!).
- The socket module now provides the functions inet_pton and inet_ntop
for converting between string and packed representation of IP addresses.
See SF patch #658327.
This still needs a bit of work in the doc area, because it is not
available on all platforms (especially not on Windows).
Barry Warsaw [Thu, 24 Apr 2003 18:14:49 +0000 (18:14 +0000)]
Updated a bunch of docs to describe how message ids and strings are
Unicode in GNUTranslations. Also provide better descriptions of
*gettext() overridden methods, esp. w.r.t. the behavior in the face of
fallbacks.
Barry Warsaw [Thu, 24 Apr 2003 18:13:39 +0000 (18:13 +0000)]
GNUTranslations:
__init__(): Removed since we no longer need the coerce flag.
Message ids and strings are now always coerced to Unicode, /if/
the catalog specified a charset parameter.
gettext(), ngettext(): Since the message strings are Unicodes in
the catalog, coerce back to encoded 8-bit strings on return.
ugettext(), ungettext(): Coerce the message ids to Unicode when
there's no entry for the id in the catalog.
Minor code cleanups; use booleans where appropriate.
SF bug 665835: filter() treatment of str and tuple inconsistent
As a side issue on this bug, it was noted that list and tuple iterators
used macros to directly access containers and would not recognize
__getitem__ overrides. If the method is overridden, the patch returns
a generic sequence iterator which calls the __getitem__ method; otherwise,
it returns a high custom iterator with direct access to container elements.