Commit Graph

30839 Commits

Author SHA1 Message Date
Tim Peters e2f6899fd6 Since it's impossible to build Python using VC7.1 on a command.com
system, exploit cmd.exe's setlocal function in this directory.
2004-08-30 21:27:55 +00:00
Tim Peters e82b00f14f Updated test-runner .bat for new location of Tcl/Tk.
Replaced outcomes from native Tcl/Tk tests.  Maybe the diffs are legit,
maybe not.  I noticed that the Tcl results I'm replacing here claimed
both that there were no failures, and that one file had tests with
failures, so I wasn't inclined to trust them <wink>.
2004-08-30 21:14:51 +00:00
Tim Peters d311538a93 win32_urandom(): There's no need to copy the generated byte string, so
don't.
2004-08-30 17:36:46 +00:00
Tim Peters 9b279a8df4 win32_urandom(): pass the function name to PyArg_ParseTuple, for better
error msgs.
2004-08-30 17:10:53 +00:00
Tim Peters 51eba6115d win32_urandom(): Raise ValueError if the argument is negative. 2004-08-30 17:08:02 +00:00
Tim Peters 4ad8217ae9 win32_urandom(): Rewrite to Python C standards (hard tabs, function name
in first column, no parens around return value).
2004-08-30 17:02:04 +00:00
Tim Peters 38330fe5ef The distinction between comparison flags and reporting flags isn't unique
to unittest, so make it official:  new module constants COMPARISON_FLAGS
and REPORTING_FLAGS, which are bitmasks or'ing together the relevant
individual option flags.

set_unittest_reportflags():  Reworked to use REPORTING_FLAGS, and
simplified overly complicated flag logic.

class FakeModule:  Removed this; neither documented nor used.
2004-08-30 16:19:24 +00:00
Johannes Gijsbers ed047486f5 Fix build error: \filename{/dev/urandom} -> \file{/dev/urandom}. 2004-08-30 15:03:23 +00:00
Johannes Gijsbers 5ae9743ea6 Bug #1014775: update NEWS.help for changes in docutils. 2004-08-30 14:33:25 +00:00
Johannes Gijsbers 343cb8a768 Bug #1014770: apply some rest-foo and fix some docutils errors. 2004-08-30 14:27:11 +00:00
Johannes Gijsbers 4c11f6088a Patch #934356: if a module defines __all__, believe that rather than using
heuristics for filtering out imported names.
2004-08-30 14:13:04 +00:00
Johannes Gijsbers d2a1aa4b1e Whitespace normalization. 2004-08-30 13:39:50 +00:00
Johannes Gijsbers 4a9faa1ea0 Patch #1003640: replace checkline() function parsing with new breakpoint logic:
1) When a breakpoint is set via a function name:
- the breakpoint gets the lineno of the def statement
- a new funcname attribute is attached to the breakpoint

2) bdb.effective() calls new function checkfuncname() to handle:
- def statement is executed: don't break.
- a first executable line of a function with a breakpoint on the lineno of the
def statement is reached: break.

This fixes bugs 976878, 926369 and 875404. Thanks Ilya Sandler.
2004-08-30 13:29:44 +00:00
Andrew M. Kuchling cb7b3f30d6 Add items 2004-08-30 11:58:04 +00:00
Johannes Gijsbers ae882f7984 Patch #941486: add os.path.lexists(). Also fix bug #940578 by using lexists in glob.glob. 2004-08-30 10:19:56 +00:00
Martin v. Löwis d3f61a2de6 Pickup Tk from tcltk directory. 2004-08-30 09:22:30 +00:00
Martin v. Löwis 6de2d4da7d Bump Tk version to 8.4.7. Build into tcltk directory. 2004-08-30 09:22:04 +00:00
Raymond Hettinger 356a4599ac Teach the random module about os.urandom().
* Use it for seeding when it is available.
* Provide an alternate generator based on it.
2004-08-30 06:14:31 +00:00
Tim Peters cd97da3b1d long_pow(): Fix more instances of leaks in error cases.
Bugfix candidate -- although long_pow() is so different now I doubt a
patch would apply to 2.3.
2004-08-30 02:58:59 +00:00
Tim Peters 47e52ee0c5 SF patch 936813: fast modular exponentiation
This checkin is adapted from part 2 (of 3) of Trevor Perrin's patch set.

BACKWARD INCOMPATIBILITY:  SHIFT must now be divisible by 5.  AFAIK,
nobody will care.  long_pow() could be complicated to worm around that,
if necessary.

long_pow():
  - BUGFIX:  This leaked the base and power when the power was negative
    (and so the computation delegated to float pow).
  - Instead of doing right-to-left exponentiation, do left-to-right.  This
    is more efficient for small bases, which is the common case.
  - In addition, if the exponent is large (more than FIVEARY_CUTOFF
    digits), precompute [a**i % c for i in range(32)], and go left to
    right 5 bits at a time.
l_divmod():
  - The signature changed so that callers who don't want the quotient,
    or don't want the remainder, can pass NULL in the slot they don't
    want.  This saves them from having to declare a vrbl for unwanted
    stuff, and remembering to decref it.
long_mod(), long_div(), long_classic_div():
  - Adjust to new l_divmod() signature, and simplified as a result.
2004-08-30 02:44:38 +00:00
Tim Peters 48bd7f3a71 Whitespace normalization. test_difflib passes again. 2004-08-29 22:38:38 +00:00
Tim Peters 0973b99e1c SF patch 936813: fast modular exponentiation
This checkin is adapted from part 1 (of 3) of Trevor Perrin's patch set.

x_mul()
  - sped a little by optimizing the C
  - sped a lot (~2X) if it's doing a square; note that long_pow() squares
    often
k_mul()
  - more cache-friendly now if it's doing a square
KARATSUBA_CUTOFF
  - boosted; gradeschool mult is quicker now, and it may have been too low
    for many platforms anyway
KARATSUBA_SQUARE_CUTOFF
  - new
  - since x_mul is a lot faster at squaring now, the point at which
    Karatsuba pays for squaring is much higher than for general mult
2004-08-29 22:16:50 +00:00
Tim Peters afb5f94217 Reverting whitespace normalization. test_difflib fails with it -- the
test depends on invisible trailing whitespace in .py files.  The author will
have to repair that.
2004-08-29 19:33:36 +00:00
Tim Peters 45e77c55ff Whitespace normalization. 2004-08-29 18:47:31 +00:00
Martin v. Löwis a28b3e6dfb Patch #727483: Add AUTH_TYPE and REMOTE_USER. 2004-08-29 16:53:26 +00:00
Martin v. Löwis 061f132898 Patch #973204: Use -rpath instead of -R on Irix and Tru64. 2004-08-29 16:40:55 +00:00
Martin v. Löwis e064b41f5a Patch #914575: difflib side by side diff support, diff.py s/b/s HTML option. 2004-08-29 16:34:40 +00:00
Martin v. Löwis 87fa785f0f Centralize WITH_TSC processing. 2004-08-29 15:51:52 +00:00
Martin v. Löwis dc3883f671 Patch #934711: Expose platform-specific entropy. 2004-08-29 15:46:35 +00:00
Raymond Hettinger 6ab78cd0c0 SF feature request #992967: array.array objects should support sequences.
Made the constructor accept general iterables.
2004-08-29 07:50:43 +00:00
Tim Peters df7a208ff7 Whitespace normalization. 2004-08-29 00:38:17 +00:00
Jim Fulton fafd874bc8 Added an __iter__ method for test suites. 2004-08-28 15:22:12 +00:00
Jim Fulton 9f556a408b setUp and tearDown functions are now passed the test object 2004-08-28 14:58:31 +00:00
Jim Fulton f54bad4564 - setUp and tearDown functions are now passed the test object
- Added a set_unittest_reportflags to set default reporting flags used
  when running doctests under unittest control.
2004-08-28 14:57:56 +00:00
Tim Peters 91879ab8ea PyUnicode_Join(): Bozo Alert. While this is chugging along, it may
need to convert str objects from the iterable to unicode.  So, if
someone set the system default encoding to something nasty enough,
the conversion process could mutate the input iterable as a side
effect, and PySequence_Fast doesn't hide that from us if the input was
a list.  IOW, can't assume the size of PySequence_Fast's result is
invariant across PyUnicode_FromObject() calls.
2004-08-27 22:35:44 +00:00
Tim Peters 05eba1fdc8 PyUnicode_Join(): Rewrote to use PySequence_Fast(). This doesn't do
much to reduce the size of the code, but greatly improves its clarity.
It's also quicker in what's probably the most common case (the argument
iterable is a list).  Against it, if the iterable isn't a list or a tuple,
a temp tuple is materialized containing the entire input sequence, and
that's a bigger temp memory burden.  Yawn.
2004-08-27 21:32:02 +00:00
Tim Peters cca018356d Removed old "if 0:" block for leak detection; wouldn't work anymore anyway. 2004-08-27 15:29:59 +00:00
Tim Peters aef8cfaa28 Don't really need ellipsis doctests for the syntax errors, because
this module imports itself explicitly from test (so the "file names"
current doctest synthesizes for examples don't vary depending on how
test_generators is run).
2004-08-27 15:12:49 +00:00
Edward Loper 0fafacc672 Removed outdated comment 2004-08-27 14:56:58 +00:00
Tim Peters 77dcccca0c Fixed 6 failures due to doctest changes. 2004-08-27 05:44:51 +00:00
Tim Peters 108f137519 test_bug1001011(): Verify that
s.join([t]) is t

for (s, t) in (str, str), (unicode, unicode), and (str, unicode).
For (unicode, str), verify that it's *not* t (the result is promoted
to unicode instead).  Also verify that when t is a subclass of str or
unicode that "the right thing" happens.
2004-08-27 05:36:07 +00:00
Tim Peters 894c512c2f PyUnicode_Join(): Missed a spot where I intended a cast from size_t to
int.  I sure wish MS would gripe about that!  Whatever, note that the
statement above it guarantees that the cast loses no info.
2004-08-27 05:08:36 +00:00
Brett Cannon 269ab628d7 Fix the spelling of Fredrik Lundh's last name (unless there really is a
"Fredrik Lund" who contributed the code in question).
2004-08-27 05:00:22 +00:00
Edward Loper 12a4baf5a1 Remove unused method _OutputRedirectingPdb.resume 2004-08-27 04:29:23 +00:00
Edward Loper 2de91ba2ab - Removed redundant call to expandtabs in DocTestParesr.
- Improvements to interactive debugging support:
  - Changed the replacement pdb.set_trace to redirect stdout to the
    real stdout *only* during interactive debugging; stdout from code
    continues to go to the fake stdout.
  - When the interactive debugger gets to the end of an example,
    automatically continue.
  - Use a replacement linecache.getlines that will return source lines
    from doctest examples; this makes the source available to the
    debugger for interactive debugging.
- In test_doctest, use a specialized _FakeOutput class instead of a
  temporary file to fake stdin for the interactive interpreter.
2004-08-27 02:07:46 +00:00
Tim Peters 8ce9f16259 PyUnicode_Join(): Two primary aims:
1. u1.join([u2]) is u2
2. Be more careful about C-level int overflow.

Since PySequence_Fast() isn't needed to achieve #1, it's not used -- but
the code could sure be simpler if it were.
2004-08-27 01:49:32 +00:00
Edward Loper 00f8da77e7 - Added DocTestParser.parse(), which parses a docstring into Examples
and intervening text strings.
- Removed DocTestParser.get_program(): use script_from_examples()
  instead.
- Fixed bug in DocTestParser._INDENT_RE
- Fixed bug in DocTestParser._min_indent
- Moved _want_comment() to the utility function section
2004-08-26 18:05:07 +00:00
Walter Dörwald 57d88e5abd Move test_bug1001011() to string_tests.MixinStrUnicodeTest so that
it can be used for str and unicode. Drop the test for
   "".join([s]) is s
because this is an implementation detail (and doesn't work for unicode)
2004-08-26 16:53:04 +00:00
Johannes Gijsbers 592ef6110f Correct incorrect "it's" to "its". 2004-08-26 10:40:12 +00:00
Tim Peters e7edcb8e22 output_difference(): In fancy-diff cases, the way this split expected &
actual output into lines created spurious empty lines at the ends of
each.  Those matched, but the fancy diffs had surprising line counts (1
larger than expected), and tests kept having to slam <BLANKLINE> into the
expected output to account for this.  Using the splitlines() string method
with keepends=True instead accomplishes what was intended directly.
2004-08-26 05:44:27 +00:00