Commit Graph

3396 Commits

Author SHA1 Message Date
Tim Peters e890682e52 Whitespace normalization. 2005-04-20 17:45:13 +00:00
Brett Cannon f4189916e3 Flush out support for ``class B(): pass`` syntax by adding support to the
'parser' module and 'compiler' package.

Closes patch #1176012.  Thanks logistix.
2005-04-09 02:30:16 +00:00
Brett Cannon 4ebc7e3bd0 Add test for ``class B1(): pass``. 2005-04-09 01:27:37 +00:00
Tim Peters f754f5fd68 test_default_encoding_issues(): Fully restore sys.setdefaultencoding.
test_site often failed under "regrtest.py -r", because this xmlrpc test
left sys with a setdefaultencoding attribute, but loading site.py removes
that attribute and test_site.py verifies the attribute is gone.  Changed
this test to get rid of sys.setdefaultencoding if it didn't exist when
this test started.

Don't know whether this is a bugfix (backport) candidate.
2005-04-08 18:00:59 +00:00
Walter Dörwald 7a6dc139de Fix for SF bug #1175396: readline() will now read one more character, if
the last character read is "\r" (and size is None, i.e. we're allowed to
call read() multiple times), so that we can return the correct line ending
(this additional character might be a "\n").

If the stream is temporarily exhausted, we might return the wrong line ending
(if the last character read is "\r" and the next one (after the byte stream
provides more data) is "\n", but at least the atcr member ensure that we
get the correct number of lines (i.e. this "\n" will not be treated as
another line ending.)
2005-04-04 21:38:47 +00:00
Hye-Shik Chang ac89f6ef29 Fix testcase for 64bit BSD systems: long is 8 bytes for those systems
so there's no need to pad after off_t members.  And a small typo fix.
2005-04-04 15:21:04 +00:00
Michael W. Hudson e2749cb264 Fix for rather inaccurately titled bug
[ 1165306 ] Property access with decorator makes interpreter crash

Don't allow the creation of unbound methods with NULL im_class, because
attempting to call such crashes.

Backport candidate.
2005-03-30 16:32:10 +00:00
Tim Peters eba28bea9b Whitespace normalization. 2005-03-28 01:08:02 +00:00
Raymond Hettinger fdf3bd6630 SF patch #1171417: bug fix for islice() in docs 2005-03-27 20:11:44 +00:00
Raymond Hettinger 267b868f23 * Fix decimal's handling of foreign types. Now returns NotImplemented
instead of raising a TypeError.  Allows other types to successfully
  implement __radd__() style methods.
* Remove future division import from test suite.
* Remove test suite's shadowing of __builtin__.dir().
2005-03-27 10:47:39 +00:00
Raymond Hettinger e6c470f255 SF bug #1770766: weakref proxy has incorrect __nonzero__ behavior. 2005-03-27 03:04:54 +00:00
Walter Dörwald 09a3f2cc2f Add tests for tuple, list and UserList that initialize the object from
various iterables.

(Copied from test_deque.py as suggested by Jim Jewett in SF bug #1166274)
2005-03-22 22:43:28 +00:00
Walter Dörwald c448a91ee8 Fix typo. 2005-03-22 11:22:38 +00:00
Walter Dörwald 7355e8133d Add list tests that ensure that remove() removes the first occurrence.
(Copied from test_deque.py as suggested by Jim Jewett in SF bug #1166274)
2005-03-21 21:31:47 +00:00
Raymond Hettinger d73202c596 Apply remove's mutation test after every equality test. 2005-03-19 00:00:51 +00:00
Raymond Hettinger 4aec61e0fc Add a remove() method to collections.deque objects. 2005-03-18 21:20:23 +00:00
Raymond Hettinger bea3f6f5c7 Bug #1163325: "special" decimals aren't hashable 2005-03-15 04:59:17 +00:00
Walter Dörwald 729c31f5c3 Reset internal buffers when seek() is called. This fixes SF bug #1156259. 2005-03-14 19:06:30 +00:00
Johannes Gijsbers a5855d5ace Patch #1159931/bug #1143895: inspect.getsource failed when functions,
etc., had comments after the colon, and some other cases. This patch
take a simpler approach that doesn't rely on looking for a ':'. Thanks
Simon Percivall!
2005-03-12 16:37:11 +00:00
Raymond Hettinger f77d0334f3 Revised the itertools quantifier recipes to match the performance of the
new builtins.
2005-03-11 22:17:30 +00:00
Raymond Hettinger 96229b1918 Add two new functions, any() and all(). 2005-03-11 06:49:40 +00:00
Raymond Hettinger 26e512a04f Test partial() with bound/unbound methods. 2005-03-11 06:48:49 +00:00
Brett Cannon 01668a1ab9 Fix test for socket.getfqdn() to also include the name returned by
socket.gethostname() in the check for a valid return.

Also clarified docs (official and docstring) that the value from gethostname()
is returned if gethostbyaddr() doesn't do the job.
2005-03-11 00:04:17 +00:00
Raymond Hettinger 984f9bb714 operator.itemgetter() and operator.attrgetter() now support extraction
of multiple fields.  This provides direct support for sorting by
multiple keys.
2005-03-09 16:38:48 +00:00
Martin v. Löwis e2713becd8 Build with --disable-unicode again. Fixes #1158607.
Will backport to 2.4.
2005-03-08 15:03:08 +00:00
Martin v. Löwis b60ae99601 Convert file names of posix.access according to the file system encoding. 2005-03-08 09:10:29 +00:00
Raymond Hettinger c8b6d1bd8c Make functional.partial() more closely match the spec by emulating
some useful features of regular functions:

* Made weak referencable.
* Allow attribute access so a user can set __name__, __doc__, etc.
2005-03-08 06:14:50 +00:00
Greg Ward 50682d0f78 SF #818006: merge from release24-maint branch: add useful read-only
attributes to oss_audio_device object: 'closed', 'name', and 'mode'.
2005-03-07 01:41:11 +00:00
Martin v. Löwis 78be7df9e4 Patch #918101: Add tarfile open mode r|* for auto-detection of the
stream compression; add, for symmetry reasons, r:* as a synonym of r.
2005-03-05 12:47:42 +00:00
Brett Cannon 653a5adcca Tweak test_communicate_stderr so that it works when run under a pydebug build. 2005-03-05 06:40:52 +00:00
Greg Ward 40407943b7 SF #1149508: ensure textwrap handles hyphenated numbers correctly,
eg. "2004-03-04" is not broken across lines.  (Merged from 2.4 branch.)
2005-03-05 02:53:17 +00:00
Peter Astrand f7f1bb7ff5 Only run extensive subprocess tests if -usubprocess to regrtest is specified. Fixes #1124637 2005-03-03 20:47:37 +00:00
Peter Astrand cbac93c229 Added three more testcases: Using communicate with only one of
stdin/stdout/stderr redirected.
2005-03-03 20:24:28 +00:00
Raymond Hettinger b67cc80bb9 SF bug #1155938: Missing None check for __init__(). 2005-03-03 16:45:19 +00:00
Martin v. Löwis 6ce7ed23d0 Revert previous checkin on getargs 'L' code. Try to convert all
numbers in PyLong_AsLongLong, and update test suite accordingly.
Backported to 2.4.
2005-03-03 12:26:35 +00:00
Martin v. Löwis 7fe60c0a0a Patches #749830, #1144555: allow UNIX mmap size to default to current
file size.
2005-03-03 11:22:44 +00:00
Martin v. Löwis c5574e809b Patch #1117454: Remove code to special-case cookies without values
in LWPCookieJar. Backported to 2.4.
2005-03-03 10:57:37 +00:00
Martin v. Löwis 4ea3eade51 Patch #1117339: Add cookielib special name tests.
Backported to 2.4.
2005-03-03 10:48:12 +00:00
Martin v. Löwis ff232d7230 Clear internal call error in 'L' format. Fixes #723201.
Backported to 2.4.
2005-03-03 09:24:38 +00:00
Martin v. Löwis df24153f65 Patch #1107973: tarfile.ExFileObject iterators. 2005-03-03 08:17:42 +00:00
Brett Cannon e94e74a8e1 Make test__locale more fine-grained. Now test localeconv and nl_langinfo
individually as tests.

Also improved output when the test fails.
2005-03-01 03:15:50 +00:00
Raymond Hettinger 9c323f8de4 SF patch #941881: PEP 309 Implementation (Partial Function Application).
Combined efforts of many including Peter Harris, Hye-Shik Chang,
Martin v. Löwis, Nick Coghlan, Paul Moore, and Raymond Hettinger.
2005-02-28 19:39:44 +00:00
Martin v. Löwis c2a0ac20b7 Patch #1049151: adding bool support to xdrlib.py.
Also add xdrlib._test into the test suite.
2005-02-24 20:22:10 +00:00
Raymond Hettinger afd842f5b2 Teach the peepholer to fold unary operations on constants.
Afterwards, -0.5 loads in a single step and no longer requires a runtime
UNARY_NEGATIVE operation.
2005-02-20 12:46:54 +00:00
Raymond Hettinger 57e7447c44 * Beef-up tests for str.count().
* Speed-up str.count() by using memchr() to fly between first char matches.
2005-02-20 09:54:53 +00:00
Raymond Hettinger 7cbf1bcb3e * Beef-up testing of str.__contains__() and str.find().
* Speed-up "x in y" where x has more than one character.

The existing code made excessive calls to the expensive memcmp() function.
The new code uses memchr() to rapidly find a start point for memcmp().
In addition to knowing that the first character is a match, the new code
also checks that the last character is a match.  This significantly reduces
the incidence of false starts (saving memcmp() calls and making quadratic
behavior less likely).

Improves the timings on:
    python -m timeit -r7 -s"x='a'*1000" "'ab' in x"
    python -m timeit -r7 -s"x='a'*1000" "'bc' in x"

Once this code has proven itself, then string_find_internal() should refer
to it rather than running its own version.  Also, something similar may
apply to unicode objects.
2005-02-20 04:07:08 +00:00
Walter Dörwald af3b39a182 Add support for negative indices in UserString.MutableString.__setitem__
and UserString.MutableString.__delitem__.
2005-02-18 13:22:43 +00:00
Walter Dörwald 1fd4db9c6c Fix copy & paste error. 2005-02-17 22:31:28 +00:00
Walter Dörwald 7f79152929 Add tests for the methods added by UserString.MutableString. 2005-02-17 22:03:31 +00:00
Martin v. Löwis 5510f65f5a Avoid using items() in environ.update(). Fixes #1124513.
Will backport to 2.4.
2005-02-17 21:23:20 +00:00