Commit Graph

3715 Commits

Author SHA1 Message Date
Fred Drake 5d1b5eaf55 Add code to DOMException to ensure it cannot be instantiated directly,
since the API documentation will state specifically that the specializations
must be used by the DOM implementations.
2000-12-13 16:35:53 +00:00
Martin v. Löwis 64acf1db22 Add standard DOM exception hierarchy. 2000-12-13 14:21:07 +00:00
Fred Drake 8152d32375 Update the code to better reflect recommended style:
Use != instead of <> since <> is documented as "obsolescent".
Use "is" and "is not" when comparing with None or type objects.
2000-12-12 23:20:45 +00:00
Barry Warsaw c140131995 Change the file's indentation from tabs to 4 spaces per level. 2000-12-12 23:16:51 +00:00
Barry Warsaw c7ed0e3c13 Accept Finn Bock's patch #102208 to hardcode EINVAL to 22 when errno
can't be imported.  This makes StringIO.py work with Jython.

Also, get rid of the string module by converting to string methods.

Shorten some lines by using augmented assignment where appropriate.
2000-12-12 23:12:23 +00:00
Fred Drake 132dce2246 Update the code to better reflect recommended style:
Use != instead of <> since <> is documented as "obsolescent".
Use "is" and "is not" when comparing with None or type objects.
2000-12-12 23:11:42 +00:00
Jack Jansen d49056cd90 The ".pth" code knew about the layout of Python trees on unix and
windows, but not on the mac. Fixed.
2000-12-12 22:39:04 +00:00
Guido van Rossum 1072c3872d Add popitem(). 2000-12-12 22:06:00 +00:00
Guido van Rossum b822c6138e Added test for {}.popitem(). 2000-12-12 22:02:59 +00:00
Marc-André Lemburg 988ad2bdff Changed .getaliases() support to register the new aliases in the
encodings package aliases mapping dictionary rather than in the
internal cache used by the search function.

This enables aliases to take advantage of the full normalization
process applied to encoding names which was previously not available.

The patch restricts alias registration to new aliases. Existing
aliases cannot be overridden anymore.
2000-12-12 14:45:35 +00:00
Fred Drake 6bcf4c2a0b Update the docstring.
Add a Node class that defines the NodeType constants, based on discussion
in the XML-SIG.
2000-12-11 22:29:23 +00:00
Fred Drake e1578ce204 Added tests to avoid regression on bug #125375.
roundtrip():  Show the offending syntax tree when things break; this makes
              it a little easier to debug the module by adding test cases.

(Still need better tests for this module, but there's not enough time
 today.)
2000-12-11 22:12:09 +00:00
Guido van Rossum 5b7b764afb Apply rstrip() to the lines read from _dirfile in _update(), so that a
dumbdbm archive created on Windows can be read on Unix.
2000-12-11 20:33:52 +00:00
Guido van Rossum 0aee7220db Hoepeful fix for SF bug #123924: Windows - using OpenSSL, problem with
socket in httplib.py.

The bug reports that on Windows, you must pass sock._sock to the
socket.ssl() call.  But on Unix, you must pass sock itself.  (sock is
a wrapper on Windows but not on Unix; the ssl() call wants the real
socket object, not the wrapper.)

So we see if sock has an _sock attribute and if so, extract it.

Unfortunately, the submitter of the bug didn't confirm that this patch
works, so I'll just have to believe it (can't test it myself since I
don't have OpenSSL on Windows set up, and that's a nontrivial thing I
believe).
2000-12-11 20:32:20 +00:00
Fred Drake 7c1e5adf27 Make ConfigParser.Error inherit from Exception. 2000-12-11 18:13:19 +00:00
Andrew M. Kuchling c6c2838403 (Patch #102698) Fix for a bug reported by Wade Leftwich:
StreamReader ignores the 'errors' parameter passed to its constructor
2000-12-10 15:12:14 +00:00
Barry Warsaw 23f26ce813 Fix `credits' to credit the Jython developers when running under that
interpreter.  Update and reword the credits for CPython.  Closes SF
patch #102665.
2000-12-06 22:20:07 +00:00
Sjoerd Mullender f7e84e12b3 Two changes:
- Use new Error class (subclass of RuntimeError so is backward
  compatible) which is raised when RuntimeError used to be raised.
- Report original attribute name in error messages instead of name
  mangled with namespace URL.
2000-12-06 10:37:57 +00:00
Fred Drake 3d5f7e83c7 Add test cases for ConfigParser.remove_option() behavior. This includes
coverage to ensure bug #124324 does not re-surface.
2000-12-04 16:30:40 +00:00
Fred Drake ff4a23bbcb remove_option(): Use the right variable name for the option name!
This closes bug #124324.
2000-12-04 16:29:13 +00:00
Moshe Zadka afb17fc7b2 Call of _cmp had wrong number of paramereters.
Fixed definition of _cmp.
2000-12-03 20:48:07 +00:00
Martin v. Löwis 1d99433a58 Convert Unicode strings to byte strings before passing them into specific
protocols. Closes bug #119822.
2000-12-03 18:30:10 +00:00
Moshe Zadka 5725d1eb03 Backing out my changes.
Improved version coming soon to a Source Forge near you!
2000-11-30 19:30:21 +00:00
Moshe Zadka 1a62750eda Added .first{item,value,key}() to dictionaries.
Complete with docos and tests.
OKed by Guido.
2000-11-30 12:31:03 +00:00
Tim Peters a3a3a030af Fox for SF bug #123859: %[duxXo] long formats inconsistent. 2000-11-30 05:22:44 +00:00
Guido van Rossum 15ffc71c0f Slight improvement to Unicode test suite, inspired by patch #102563:
also test join method of 8-bit strings.

Also changed the test() function to (1) compare the types of the
expected and actual result, and (2) in verbose mode, print the repr()
of the output.
2000-11-29 12:13:59 +00:00
Guido van Rossum f8baad0f17 Patch by Finn Bock to support PyStringMap in Jython. 2000-11-27 21:53:14 +00:00
Fred Drake b7f0cef54d Update test output. 2000-11-21 22:03:09 +00:00
Fred Drake a1bde802f1 testInsertBefore(): Rewritten to actually test insertBefore() somewhat.
testAAA(),
testAAB():  Added checks that the results are right.

testTooManyDocumentElements():  Added code to actually test this.

testCloneElementDeep()
testCloneElementShallow():  Filled these in with test code.

_testCloneElementCopiesAttributes(),
_setupCloneElement():  Helper functions used with the other
        testCloneElement*() functions.

testCloneElementShallowCopiesAttributes():  No longer a separate test;
        _setupCloneElement() uses _testCloneElementCopiesAttributes() to
        test that this is always done.

testNormalize():  Added to check Node.normalize().
2000-11-21 22:02:43 +00:00
Fred Drake 4ccf4a1e8a Reduce the visibility of imported modules for cleaner "from ... import *"
behavior.

Added support for the Attr.ownerElement attribute.

Everywhere:  Define constant object attributes in the classes rather than
on the instances during object construction.  This reduces the amount of
work needed for object construction and destruction; these need to be
lightweight operations on a DOM.

Node._get_firstChild(),
Node._get_lastChild():  Return None if there are no children (required for
        compliance with DOM level 1).

Node.insertBefore():  If refChild is None, append the new node instead of
        failing (required for compliance).  Also, update the sibling
        relationships.  Return the inserted node (required for compliance).

Node.appendChild():  Update the parent of the appended node.

Node.replaceChild():  Actually replace the old child!  Update the parent
        and sibling relationships of both the old and new children.  Return
        the replaced child (required for compliance).

Node.normalize():  Implemented the normalize() method.  Required for
        compliance, but missing from the release.  Useful for joining
        adjacent Text nodes into a single node for easier processing.

Node.cloneNode():  Actually make this work.  Don't let the new node share
        the instance __dict__ with the original.  Do proper recursion if
        doing a "deep" clone.  Move the attribute cloning out of the base
        class, since only Element is supposed to have attributes.

Node.unlink():  Simplify handling of child nodes for efficiency, and
        remove the attribute handling since only Element nodes support
        attributes.

Attr.cloneNode():  Extend this to clear the ownerElement attribute in
        the clone.

AttributeList.items(),
AttributeList.itemsNS():  Slight performance improvement (avoid lambda).

Element.cloneNode():  Extend Node.cloneNode() with support for the
        attributes.  Clone the Attr objects after creating the underlying
        clone.

Element.unlink():  Clean out the attributes here instead of in the base
        class, since this is the only class that will have them.

Element.toxml():  Adjust to create only one AttributeList instance; minor
        efficiency improvement.

_nssplit():  No need to re-import string.

Document.__init__():  No longer needed once constant attributes are
        initialized in the class itself.

Document.createElementNS(),
Document.createAttributeNS():  Use the defined constructors rather than
        directly access the classes.

_get_StringIO():  New function.  Create an output StringIO using the most
        efficient available flavor.

parse(),
parseString():  Import pulldom here instead of in the public namespace of
        the module.
2000-11-21 22:02:22 +00:00
Tim Peters cc78e47bcd Verify that str(a) and repr(a) don't blow up (part of SF patch 102068). 2000-11-14 21:36:07 +00:00
Guido van Rossum 2595a837b5 Typo for Mac code, fixing SF bug 12195. 2000-11-13 20:30:57 +00:00
Guido van Rossum 56baca328f Removing DOS 8x3 support 2000-11-13 17:11:45 +00:00
Greg Ward f6fc875831 Jack Jansen: added 'get_command_list()' method, and Mac-specific code to
use it to generate a dialog for users to specify the command-line (because
providing a command-line with MacPython is so awkward).
2000-11-11 02:47:11 +00:00
Guido van Rossum a66eed62fd Implement the suggestion of bug_id=122070: surround tell() call with
try/except.
2000-11-09 18:05:24 +00:00
Barry Warsaw 17bfef5860 SMTP.connect(): If the socket.connect() raises a socket.error, be sure
to call self.close() to reclaim some file descriptors, the reraise the
exception.  Closes SF patch #102185 and SF bug #119833.
2000-11-08 22:19:47 +00:00
Fred Drake b046b76322 Added test cases to detect regression on SourceForge bug #121965. 2000-11-08 19:51:25 +00:00
Barry Warsaw 7fed217515 This fixes several bug reports concering memory bloating during large
file uploads.

In response to SF bugs 110674 and 119806, and discussions on
python-dev, we are removing the self.lines attribute from the
FieldStorage class.  Specifically touched where methods __init__(),
read_lines_to_eof(), and skip_lines().

No one can remember why self.lines was added.  Technically, it's part
of the public interface for the class, but it was never documented.
It's possible clever or nosy code will break because of this, but it
was decided to remove it and see who complains.

This resolution also closes the second half of the cgi.py entry in PEP
42.  The first half of that PEP concerns specifically binary file
uploads, where there may be no end-of-line marker for a very long
time.  This patch does not address that issue.
2000-11-06 18:46:09 +00:00
Jeremy Hylton 4ebf3be407 a few small optimizations that seem to give a 5-10% speedup; the
further optimization of com_node makes the most difference.
2000-11-06 16:03:52 +00:00
Jeremy Hylton eefaeb78b3 move pruneNext method to correct object (doh!) 2000-11-06 03:47:39 +00:00
Jeremy Hylton 314e3fb215 Change the graph structure to contain the code generator object for
embedded code objects (e.g. functions) rather than the generated code
object.  This change means that the compiler generates code for
everything at the end, rather then generating code for each function
as it finds it.  Implementation note: _convert_LOAD_CONST in
pyassem.py must be change to call getCode().

Other changes follow.  Several changes creates extra edges between
basic blocks to reflect control flow for loops and exceptions.  These
missing edges had gone unnoticed because they do not affect the
current compilation process.

pyassem.py:
    Add _enable_debug() and _disable_debug() methods that print
    instructions and blocks to stdout as they are generated.

    Add edges between blocks for instructions like SETUP_LOOP,
    FOR_LOOP, etc.

    Add pruneNext to get rid of bogus edges remaining after
    unconditional transfer ops (e.g. JUMP_FORWARD)

    Change repr of Block to omit block length.

pycodegen.py:
    Make sure a new block is started after FOR_LOOP, etc.

    Change assert implementation to use RAISE_VARARGS 1 when there is
    no user-specified failure output.

misc.py:
    Implement __contains__ and copy for Set.
2000-11-06 03:43:11 +00:00
Jeremy Hylton a59ac0a7df If a function contains a doc string, remove the doc string node from
the function's body.

If assert is used without an error message, make the AST node None
rather than Name('None').
2000-11-06 03:33:52 +00:00
Fredrik Lundh fad27aee11 Added 38,642 missing characters to the Unicode database (first-last
ranges) -- but thanks to the 2.0 compression scheme, this doesn't add
a single byte to the resulting binaries (!)

Closes bug #117524
2000-11-03 20:24:15 +00:00
Jeremy Hylton 24ec6fbc7e track recent change to test_extcall.py 2000-10-30 19:41:33 +00:00
Jeremy Hylton 6b4ec5135b Fix for SF bug #117241
When a method is called with no regular arguments and * args, defer
the first arg is subclass check until after the * args have been
expanded.

N.B. The CALL_FUNCTION implementation is getting really hairy; should
review it to see if it can be simplified.
2000-10-30 17:15:20 +00:00
Fredrik Lundh ebc37b28fa -- properly reset groups in findall (bug #117612)
-- fixed negative lookbehind to work correctly at the beginning
of the target string (bug #117242)

-- improved syntax check; you can no longer refer to a group
inside itself (bug #110866)
2000-10-28 19:30:41 +00:00
Guido van Rossum add8d86325 Fix two typos in __imul__. Closes Bug #117745. 2000-10-25 21:58:20 +00:00
Jeremy Hylton 7cff7fe21f Many changes.
Reformatting -- long lines, "[ ]" -> "[]", a few indentation nits.

Replace calls to Node function (which constructed ast nodes) with
calls to actual constructors imported from ast module.

Optimize com_node (most frequently used method) for the common case --
the appropriate method is found in _dispatch.

Fix com_augassign to use class object's rather than node names
(rendered invalid by recent changes to ast)

Remove expensive tests for sequence-ness in com_stmt and
com_append_stmt. These tests should never fail; if they do, something
is really broken and exception will be raised elsewhere.

Fix com_stmt and com_append_stmt to use isinstance rather than
testing's type slot of ast node (this slot disappeared with recent
changes to ast).
2000-10-25 18:10:32 +00:00
Jeremy Hylton 628d289d12 Generated from rev 1.1 of ast.txt 2000-10-25 18:02:59 +00:00
Jeremy Hylton 66d2c1f7e5 Small optimizations in dispatch method: 1) lookup node's __class__ once
and store in local; 2) define _preorder to be dispatch (rather than
method that called dispatch).
2000-10-25 18:02:02 +00:00
Guido van Rossum 1378bd5b0b Also point TK_LIBRARY to the appropriate directory.
Changed the landmark to tclIndex, which should occur in both.
2000-10-25 17:42:13 +00:00
Fred Drake 661ea26b3d Ka-Ping Yee <ping@lfw.org>:
Changes to error messages to increase consistency & clarity.

This (mostly) closes SourceForge patch #101839.
2000-10-24 19:57:45 +00:00
Guido van Rossum bd6f4fba1b Insert the current directory to the front of sys.path -- and remove it
at the end.  This fixes a problem where

	python Lib/test/test_import.py

failed while "make test" succeeded.
2000-10-24 17:16:32 +00:00
Lars Gustäbel 0702507ea2 Added a test case for the saxutils.prepare_input_source setSystemId bug. 2000-10-24 16:00:22 +00:00
Lars Gustäbel 4ced5e7675 Fix bug in prepare_input_source (patched by Paul P., sourceforge.net down
now, so can't find number).
2000-10-24 15:53:12 +00:00
Lars Gustäbel cfd3bd838c Updated output. 2000-10-24 15:36:28 +00:00
Lars Gustäbel 2fc5294911 Added some more tests here and there. 2000-10-24 15:35:07 +00:00
Fred Drake d038ca830f Make reindent.py happy (convert everything to 4-space indents!). 2000-10-23 18:31:14 +00:00
Fred Drake 16f6329e61 Make reindent.py happy (lots of trailing whitespace removed). 2000-10-23 18:09:50 +00:00
Fred Drake 098b55ab44 Make reindent happy, but not in the way it planned! 2000-10-23 17:30:23 +00:00
Fred Drake 004d5e6880 Make reindent.py happy (convert everything to 4-space indents!). 2000-10-23 17:22:08 +00:00
Fred Drake 2e6d25c5bb Use 4-space indents. 2000-10-23 17:00:30 +00:00
Fred Drake 2ec80faae5 Clean up the temporary file when done with it. 2000-10-23 16:59:35 +00:00
Fred Drake dce5641856 Make sure the temporary file is cleaned up even when we raise TestSkipped. 2000-10-23 16:38:20 +00:00
Fred Drake 44b6bd2179 Added note saying to use test_support.TESTFN for a temporary filename,
and be clear that you need to clean it up when done.
2000-10-23 16:37:14 +00:00
Fred Drake 0aaed272a7 Added test for regression on SourceForge bug #117490. 2000-10-23 13:39:15 +00:00
Fred Drake de3518e7ca Maildir.__init__(): Make sure self.boxes is set.
This closes SourceForge bug #117490.
2000-10-23 13:37:01 +00:00
Lars Gustäbel d2f5a9ac4b Fixed a bug that caused namespace names to be reported as lists rather
than tuples.
2000-10-19 07:36:29 +00:00
Fred Drake f7ef15d6ec Use test_support.TESTFN as the temporary filename.
Fix a minor stylistic nit.

This closes SourceForge bug #117032.
2000-10-18 01:21:38 +00:00
Jeremy Hylton e21670553e the usual (part II) 2000-10-16 17:42:40 +00:00
Tim Peters 98c8184f2f Test for math.* exceptional behavior only in verbose mode, so that the
oddball platforms (where, e.g., math.exp(+huge) still fails to raise
OverflowError) don't fail the std test suite when run normally.
2000-10-16 17:35:13 +00:00
Jeremy Hylton a8268e9457 the usual 2000-10-16 17:33:50 +00:00
Barry Warsaw 75f8101c42 find(): Application of (slightly modified) SF patch #101928 by Ulf
Betlehem, verified by Peter Funk.  Fixes preservation of language
search order lost due to use of dictionary keys instead of a list.
Closes SF bug #116964.
2000-10-16 15:47:50 +00:00
Greg Ward 0eb75b42cd Bump version to 1.0.1. 2000-10-15 19:20:20 +00:00
Lars Gustäbel 55b4efd034 Fixed minor problem with reset(). 2000-10-14 10:28:01 +00:00
Greg Ward 047c3723d0 Removed debugging code at bottom. 2000-10-14 04:07:39 +00:00
Greg Ward fa9ff76aae Untabified. 2000-10-14 04:06:40 +00:00
Greg Ward 4cd6f2ab80 Bastian Kleineidam: make 'check_lib()' more like AC_CHECK_LIB by adding
an 'other_libraries()' parameter.
2000-10-14 03:56:42 +00:00
Greg Ward 0b4dafc39b Lyle Johnson: use 'normcase()' in addition to 'normpath()' when testing if
we actually installed modules to a directory in sys.path.
2000-10-14 03:47:07 +00:00
Greg Ward 2e38a50db1 Bastian Kleineidam: fix up any supplied command-line options. 2000-10-14 03:40:20 +00:00
Jeremy Hylton 9c048f9f65 Now supports entire Python 2.0 language and still supports Python
1.5.2.  The compiler generates code for the version of the interpreter
it is run under.

ast.py:
    Print and Printnl add dest attr for extended print
    new node AugAssign for augmented assignments
    new nodes ListComp, ListCompFor, and ListCompIf for list
        comprehensions

pyassem.py:
    add work around for string-Unicode comparison raising UnicodeError
        on comparison of two objects in code object's const table

pycodegen.py:
    define VERSION, the Python major version number
    get magic number using imp.get_magic() instead of hard coding
    implement list comprehensions, extended print, and augmented
        assignment; augmented assignment uses Delegator classes (see
        doc string)
    fix import and tuple unpacking for 1.5.2

transformer.py:
    various changes to support new 2.0 grammar and old 1.5 grammar
    add debug_tree helper than converts and symbol and token numbers
    to their names
2000-10-13 21:58:13 +00:00
Lars Gustäbel 5bad5a4be2 Updated test suite to latest pulldom changes. 2000-10-13 20:54:10 +00:00
Lars Gustäbel ec964d5b21 Moved appendChild calls back to DOMEventStream.
Added SAX2DOM class.
2000-10-13 20:53:27 +00:00
Paul Prescod 4221ff0ee1 Clear siblings, now that they are being set. 2000-10-13 20:11:42 +00:00
Neil Schemenauer 8a00abc0ff Make the regrtest.py -l (findleaks) option considerably less obnoxious.
First, only report garbage that the GC cannot free.  Second, only report
the number of objects found, not their repr().  People can dig deeper on
their own if they find a leak.
2000-10-13 01:32:42 +00:00
Jeremy Hylton 4e1be72e6b Fix SF bug #116263: support for from .. import *
transformer.py: return '*', None from com_import_as_name
pycodegen.py: special case for name == '*'
pyassem.py: fix stack counting for IMPORT_ opcodes
2000-10-12 20:23:23 +00:00
Jeremy Hylton 110941a4ba If the status line is invalid, assume it is a pre-1.0 response. The
msg/headers are empty and the entire response is treated as the body.
2000-10-12 19:58:36 +00:00
Thomas Heller 20d529be26 Recreated after installer source code changes.
This should close SF bug (patch)
http://sourceforge.net/patch/?func=detailpatch&patch_id=101844&group_id=5470
2000-10-12 19:31:13 +00:00
Jeremy Hylton 73574eefe5 two fixes for redirects:
- don't close the fp, since that appears to also close the socket
    - join the original url with the redirect reponse to deal with
      relative redirect URL

wrap two socket ops in try/except to turn them into URLErrors, so that
client code need only catch one exception.

in HTTPError.__del__ only close fp if fp is not None

style changes:
    - use f(*args) instead of apply(f, args)
    - use __super_init instead of super.__init__(self, ...)
2000-10-12 18:54:18 +00:00
Jeremy Hylton 3b0c600394 cosmetic changes only:
use standard Python style for whitespace near = and ()
2000-10-12 17:31:36 +00:00
Guido van Rossum 22d5895dc3 Added a test for the StringIO write() error I just fixed. 2000-10-12 16:46:28 +00:00
Guido van Rossum b636dc67ed [ Bug #116636 ] Bug in StringIO.write()
http://sourceforge.net/bugs/?func=detailbug&bug_id=116636&group_id=5470
bobalex@rsv.ricoh.com

Bug report: If the file position is less than the end of the "file",
and a write is performed extending past then end of the file, the data
string is corrupted.

Solution: in write(), when writing past the end, properly set self.len
when newpos is > self.len.
2000-10-12 16:45:37 +00:00
Guido van Rossum 2e2a70abe4 Anonymous patch to add Darwin 1.2 to the list of BSDs.
Let's hope this is correct (I'm not sure why the sys.platform would be
'Darwin1.2' rather than 'darwin1', which seems to be the convention).

Someone with Darwin please test this!
2000-10-12 16:01:55 +00:00
Barry Warsaw 0157e7aa3e Added some single tuple/list unpacking for JPython regression testing. 2000-10-12 14:45:58 +00:00
Tim Peters cb5b5bac11 A Mystery: I somehow managed to delete the last two lines of my test_math.py
changes.  Here restoring them.
2000-10-12 07:15:55 +00:00
Tim Peters 1d120619d4 Stop raising OverflowError on underflows reported by libm (errno==ERANGE and
libm result is 0).  Cautiously add a few libm exception test cases:
1. That exp(-huge) returns 0 without exception.
2. That exp(+huge) triggers OverflowError.
3. That sqrt(-1) raises ValueError specifically (apparently under glibc linked
   with -lieee, it was raising OverflowError due to an accident of the way
   mathmodule.c's CHECK() macro happened to deal with Infs and NaNs under gcc).
2000-10-12 06:10:25 +00:00
Lars Gustäbel f27f5ab31f Added additional test cases for pulldom modifications. 2000-10-11 22:36:00 +00:00
Lars Gustäbel bc1b5c81a5 Added parent attribute with getters and setters on XMLFilterBase. 2000-10-11 22:35:00 +00:00
Lars Gustäbel d178ba666b Added non-ns start and end element methods.
Moved appendChild calls from DOMEventStream to PullDOM (parser indep).
Removed duplicated sibling pointer setting (duplicated in appendChild).
2000-10-11 22:34:04 +00:00
Fred Drake cb953d72d2 Test the exception-raising for error cases in copy_reg. 2000-10-11 22:17:35 +00:00
Fred Drake 78a6a36964 In the module docstring, clarify that this is used to register pickle
support for extension types, not classes.

pickle():  If the type is a class or if the reduction function is not
           callable, raise a TypeError.

constructor():  If the constructor is not callable, raise TypeError.

This (partially) closes SourceForge patch #101859.
2000-10-11 22:16:45 +00:00
Guido van Rossum 4bbea05c4e Jack Jansen reported that the regression test failed on the Mac where
string.letters was much more than expected.

Solution: explicit is better than implicit; don't rely on
string.letters.
2000-10-11 21:34:53 +00:00
Barry Warsaw 7e3e1c1ece Added test cases for extended printing to an instance. This picked up
a bug in JPython where the instance had to have a flush() method.
2000-10-11 21:26:03 +00:00
Tim Peters cfc4178e84 When the classes in wave.py opened files themselves, their .close() methods
didn't bother to close the files.  This caused the new test_wave test to fail
under Windows, as Windows won't let you delete a file that's open.  Fixed
that by ensuring the wave read & write classes' .close() and __del__ methods
close files that were opened by their constructors.
2000-10-09 23:43:55 +00:00
Guido van Rossum e8d2f5589b The usual. 2000-10-09 22:14:43 +00:00
Guido van Rossum 16b198e10e wave test output 2000-10-09 20:06:50 +00:00
Guido van Rossum a00afc1ead Simple test suite for wave.py by Jean-Claude Rimbault (with some
changes to avoid using assert).
2000-10-09 20:05:59 +00:00
Fred Drake 13a3069c2b Paul Prescod <paul@prescod.net>:
Correct the chaining between siblings.
2000-10-09 20:04:16 +00:00
Guido van Rossum eca576c68b Fix by Jean-Claude Rimbault [ Bug #116271 ] -- the WAVE header was
never written properly because the '4' length indicators for the 's'
format characters were missing.
2000-10-09 20:01:53 +00:00
Fred Drake ebe73025cd Move the test for confirmation that all nodes have been freed into the
driver code, so that each test gets this; it had been done inconsistently.
Remove the lines that set the variables holding dom objects to None; not
needed since the interpreter cleans up locals on function return.
2000-10-09 19:57:39 +00:00
Guido van Rossum 95d53d2bf5 Use python$EXE instead of python, for Darwin. (Patch by Tony
Lownds. (#101816)

[Note: I'm not sure that this is really the right fix.  Surely Darwin
doesn't require you to say "python.exe" everywhere???  Even Windows
doesn't!  Or am I misunderstanding the point?]
2000-10-09 19:34:12 +00:00
Martin v. Löwis 04f4943d13 _exceptions: Format a missing system id as <unknown>.
expatreader: Use the error handler instead of raising exception directly.
2000-10-09 16:45:54 +00:00
Guido van Rossum 46735add5f Fixed leapdays(). From Patch #101841, by Denis S. Otkidach. 2000-10-09 12:42:04 +00:00
Guido van Rossum e9f922f497 Adapt test output to changed error message. 2000-10-08 19:48:46 +00:00
Guido van Rossum ce6292ebf5 Correct output. 2000-10-08 00:21:43 +00:00
Guido van Rossum 923ebe4dc6 It seems our sound cards can't play mulaw data. Use native-format
16-bit signed data instead.  Hope this works for you; it works for me.
2000-10-08 00:20:20 +00:00
Martin v. Löwis 830b37bd74 Don't use string methods to allow sharing this code with PyXML. 2000-10-07 19:03:20 +00:00
Fredrik Lundh 13ac9926ac Fixed too ambitious "nothing to repeat" check. Closes bug #114033. 2000-10-07 17:38:23 +00:00
Fred Drake 5c0b43d1e2 The test is good, but Jim forgot to check in the updated output. 2000-10-07 16:58:11 +00:00
Fred Drake 613f7c4092 Donn Cave <donn@oz.net>:
Generated files for BeOS R5.
2000-10-07 12:25:17 +00:00
Martin v. Löwis a2fda0dfab Record bugs found when comparing the module with DOM Core Level 2. 2000-10-07 12:10:28 +00:00
Fredrik Lundh 025468d246 SRE didn't handle character category followed by hyphen inside a
character class.  Fix provided by Andrew Kuchling.  Closes bug
#116251.
2000-10-07 10:16:19 +00:00
Marc-André Lemburg b96d80201c Updated test with a case which checks for the bug reported in 2000-10-07 08:52:45 +00:00
Tim Peters de49583a0d Possible fix for Skip's bug 116136 (sre recursion limit hit in tokenize.py).
tokenize.py has always used naive regexps for matching string literals,
and that appears to trigger the sre recursion limit on Skip's platform (he
has very long single-line string literals).  Replaced all of tokenize.py's
string regexps with the "unrolled" forms used in IDLE, where they're known to
handle even absurd (multi-megabyte!) string literals without trouble.  See
Friedl's book for explanation (at heart, the naive regexps create a backtracking
choice point for each character in the literal, while the unrolled forms create
none).
2000-10-07 05:09:39 +00:00
Martin v. Löwis 0a84a338f9 Add .toxml test case, as proposed by Alex Martelli in bug report #116244. 2000-10-06 22:42:55 +00:00
Martin v. Löwis 2c8a89cc3f minidom: access attribute value before printing it
correct order of constructor args in createAttributeNS
pulldom: use symbolic names for uri and localnames
         correct usage of createAttribute and setAttributeNode signatures.
2000-10-06 22:36:03 +00:00
Martin v. Löwis 80670bcaba Add a test case for reporting the file name, and for reporting an error
for incomplete input.
2000-10-06 21:13:23 +00:00
Martin v. Löwis 31b485ffb0 In an incremental parser, close the parser after feeding everything. 2000-10-06 21:12:12 +00:00
Martin v. Löwis 5fece7fc1b Don't use a file object as system id; try to propagate the file name to
the InputSource.
2000-10-06 21:11:20 +00:00
Martin v. Löwis 2aa93efda0 Don't report a final chunk for an external entity parser. 2000-10-06 21:10:34 +00:00
Martin v. Löwis ee1dc157d7 Move translation from expat.error to SAXParseException into feed, so that
callers of feed will get a SAXException.
In close, feed the last chunk first before calling endDocument, so that
the parser may report errors before the end of the document. Don't do
anything in a nested parser.
Don't call endDocument in parse; that will be called in close.
Use self._source for finding the SystemID; XML_GetBase will be cleared in
case of an error.
2000-10-06 21:08:59 +00:00
Fred Drake 24c532a512 Fix a couple of typos in docstrings. 2000-10-06 20:28:46 +00:00
Jeremy Hylton e2b7c4dea3 test_linuxaudio:
read the header from the .au file and do a sanity check
    pass only the data to the audio device
    call flush() so that program does not exit until playback is complete
    call all the other methods to verify that they work minimally
    call setparameters with a bunch of bugs arguments

linuxaudiodev.c:
    use explicit O_WRONLY and O_RDONLY instead of 1 and 0
    add a string name to each of the entries in audio_types[]
    add AFMT_A_LAW to the list of known formats
    add x_mode attribute to lad object, stores imode from open call
    test ioctl return value as == -1, not < 0
    in read() method, resize string before return
    add getptr() method, that calls does ioctl on GETIPTR or GETOPTR
        depending on x_mode
    in setparameters() method, do better error checking and raise
        ValueErrors; also use ioctl calls recommended by Open Sound
        System Programmer's Guido (www.opensound.com)
    use PyModule_AddXXX to define names in module
2000-10-06 19:39:55 +00:00
Fred Drake cc773d3b11 __getslice__(): Make this use the constructor form that gets a sequence
as a parameter; this was the only use of the base
                 constructor or surgical alteration of another object's
                 data attribute.

This change simplifies the constructor requirements for subclasses.

This relates to SourceForge bug #115928.
2000-10-06 19:26:01 +00:00
Jim Fulton d1229f5651 Uncommented tests that failed for cStringIO,
Added missing clode to make the clode test test a close. ;)
2000-10-06 19:21:32 +00:00
Tim Peters 6d699ca699 Adding Jeremy's new test_import (SF patch 101709). 2000-10-06 18:46:22 +00:00
Martin v. Löwis 962c9e7f91 Add SAXReaderNotAvailable, and use it to distinguish between an
ImportError, and a missing driver.
2000-10-06 17:41:52 +00:00
Fred Drake 02776adab8 Donn Cave <donn@u.washington.edu>:
Script to regenerate platform-specific modules of constants.

[I moved common paths to variables for easier reading by humans. -- FLD]

This closes SourceForge patch #101781.
2000-10-06 16:11:21 +00:00
Guido van Rossum 00236f38da [ Bug #110677 ] PRIVATE: various minor Tkinter things (PR#388)
http://sourceforge.net/bugs/?func=detailbug&group_id=5470&bug_id=110677

Canvas.CanvasItem & Canvas.Group:
- bind lacks an optional "add" param
- unbind lacks an optional "funcid" param
- tkraise/lower should call self.canvas.tag_XXXX

(markus.oberhumer@jk.uni-linz.ac.at)

Note: I'm *not* fixing "bbox() return value is inconsistent with
Canvas.bbox()" -- it might break existing code.
2000-10-06 00:38:51 +00:00
Tim Peters c54d19043a SF bug 115831 and Ping's SF patch 101751, 0.0**-2.0 returns inf rather than
raise ValueError.  Checked in the patch as far as it went, but also changed
all of ints, longs and floats to raise ZeroDivisionError instead when raising
0 to a negative number.  This is what 754-inspired stds require, as the "true
result" is an infinity obtained from finite operands, i.e. it's a singularity.
Also changed float pow to not be so timid about using its square-and-multiply
algorithm.  Note that what math.pow does is unrelated to what builtin pow
does, and will still vary by platform.
2000-10-06 00:36:09 +00:00
Fred Drake 034c2a9f7a Add support for "import re" -- it uses pre, but user code does not need
to.
2000-10-05 20:42:44 +00:00
Barry Warsaw 293b03f73f translation(): Minor optimization patch which avoids instantiating the
default value's instance unless it's absolutely necessary.
2000-10-05 18:48:12 +00:00
Jeremy Hylton 77249442a5 Fix Bug #115907: encode '=' as '=3D' and not '==' 2000-10-05 17:24:33 +00:00
Trent Mick d68d0a6f5a Fix for test_class.py on Win64. id(self), which on Win64 returns a
PyLong, was used for the return value of a class __hash__ method, which
*must* return a PyInt. Solution: hash() the id(self) value.
2000-10-04 17:50:59 +00:00
Tim Peters d215218178 test_popen2 broke on Windows shortly after 2.0b2 was released. Fixed it. 2000-10-03 23:07:13 +00:00
Martin v. Löwis cf0a1cc417 Support non-namespace elements in *ElementNS of XMLGenerator. 2000-10-03 22:35:29 +00:00
Fredrik Lundh d11b5e54f0 Recompile pattern if (?x) flag was found inside the pattern during the
first scan.  Closes bug #115040.
2000-10-03 19:22:26 +00:00
Guido van Rossum f19a7ac220 Fix a few problems with the _Printer class and the license variable.
1. repr(license) will no longer print to stdout and read from stdin;
you have to use license().  `license` is a short message explaining
this.

2. Use lazy initialization so that startup isn't slowed down by the
search for the LICENSE file.

3. repr(license) actually returns the desired string, rather than
printing to stdout and returning ''.  (Why didn't we think of this
before?)

4. Use the pythonlabs license URL as the license fallback instead of
the CNRI license handle.
2000-10-03 17:11:37 +00:00
Thomas Wouters f2c1be22f2 On some systems (like Solaris), the master end of a tty/pty pair is
apparently not considered a terminal, and so isatty(3) returns false. So we
skip the test for ttyness of the master side and just check the slave side,
which should really be a terminal.
2000-10-03 16:51:08 +00:00
Fredrik Lundh 65d4bc616a Fixed negative lookahead/lookbehind. Closes bug #115618. 2000-10-03 16:29:23 +00:00