Commit Graph

3337 Commits

Author SHA1 Message Date
Guido van Rossum 9e79a25b8a The minidom.Node class has a debug attribute which, when its _debug
flag is true, is set to a StringIO object that silently collects all
debug messages.  This is triggered by the Node._debug=1 statement at
the top of test_minidom.py.  After the tests, we better delete that
StringIO object to avoid wasting memory.  We also reset the _debug
flag.  (Note that this is an undetectable memory leak, and the memory
doesn't get collected by the cycle-gc either, because it's all
reachable -- it's just useless.)
2000-09-21 20:10:39 +00:00
Fred Drake 07cbc4e5bd Paul Prescod <paul@prescod.net>:
Add support for parsing already-opened files.  Make sure the parse()
method closes exactly those files that it opens.

Modified by FLD for better conformance to the Python style guide.

This closes SourceForge patch #101512.
2000-09-21 17:43:48 +00:00
Fredrik Lundh 5644b7fad1 - fixed yet another gcc -pedantic warning
- added experimental "expand" method to match objects
- don't use the buffer interface on unicode strings
2000-09-21 17:03:25 +00:00
Fred Drake 44627016da SAXException.__getitem__(): Raise AttributeError instead of NameError. 2000-09-21 16:32:28 +00:00
Jeremy Hylton d34580cb87 fix bogus references to imp; makes test_minidom succeed 2000-09-21 14:46:56 +00:00
Lars Gustäbel b798c0109f Now uses make_parser to create its parser (patch 101573). 2000-09-21 08:38:46 +00:00
Lars Gustäbel ae43e5205d Added the make_parser function (patch 101571). 2000-09-21 08:34:04 +00:00
Lars Gustäbel c5cec51b95 Updated XMLGenerator to new DocumentHandler interface (patch 101572). 2000-09-21 08:25:28 +00:00
Lars Gustäbel b4d6bb0987 Updated to correct DocumentHandler signatures. (patch 101570) 2000-09-21 08:18:55 +00:00
Tim Peters 38fd5b6413 Derived from Martin's SF patch 110609: support unbounded ints in %d,i,u,x,X,o formats.
Note a curious extension to the std C rules:  x, X and o formatting can never produce
a sign character in C, so the '+' and ' ' flags are meaningless for them.  But
unbounded ints *can* produce a sign character under these conversions (no fixed-
width bitstring is wide enough to hold all negative values in 2's-comp form).  So
these flags become meaningful in Python when formatting a Python long which is too
big to fit in a C long.  This required shuffling around existing code, which hacked
x and X conversions to death when both the '#' and '0' flags were specified:  the
hacks weren't strong enough to deal with the simultaneous possibility of the ' ' or
'+' flags too, since signs were always meaningless before for x and X conversions.
Isomorphic shuffling was required in unicodeobject.c.
Also added dozens of non-trivial new unbounded-int test cases to test_format.py.
2000-09-21 05:43:11 +00:00
Greg Ward f5855746fe Corran Webster: fix 'change_root()' to handle Mac OS paths. 2000-09-21 01:23:35 +00:00
Jeremy Hylton 572bdce4b3 change 2-space indent to 4-space indent 2000-09-20 02:47:28 +00:00
Greg Ward 9c0ea13ece *Very* belated application of Thomas Heller's patch to handle
resource files.  The gist of the patch is to treat ".rc" and ".mc"
files as source files; ".mc" files are compiled to ".rc" and then
".res", and ".rc" files are compiled to ".res".  Wish I knew what
all these things stood for...
2000-09-19 23:56:43 +00:00
Tim Peters ceeda0e9ba Treat trailing colon in os.path.join("a:", "b") same way for DOS as in
recent changes to ntpath.py and posixmodule.c.  Thanks to Guido for
pointing out the inconsistency!
2000-09-19 23:46:56 +00:00
Marc-André Lemburg d1ba443206 This patch adds a new Python C API called PyString_AsStringAndSize()
which implements the automatic conversion from Unicode to a string
object using the default encoding.

The new API is then put to use to have eval() and exec accept
Unicode objects as code parameter. This closes bugs #110924
and #113890.

As side-effect, the traditional C APIs PyString_Size() and
PyString_AsString() will also accept Unicode objects as
parameters.
2000-09-19 21:04:18 +00:00
Tim Peters 0eeba5b24b Part of SF patch 101481: on Windows, os.path.join("a:", "b") should yield
"a:b", not "a:/b".  Similar change was made to posixmodule.c earlier.
2000-09-19 20:39:32 +00:00
Tim Peters f5fa0fc640 test_userlist.py:
Added new test for new __contains__ method.
    Extensive editing to get rid of asserts.
2000-09-19 20:31:24 +00:00
Tim Peters 7b393fc037 SF patch 101391: implemented UserList.__contains__. 2000-09-19 20:29:03 +00:00
Paul Prescod 4c799191a2 Fix test errors. 2000-09-19 19:33:02 +00:00
Martin v. Löwis b96e0e5e65 New test cases for the StringIO module 2000-09-19 16:35:39 +00:00
Martin v. Löwis 89c528b02d Don't print specific Node instances unless running verbosely.
Closes Bug #114775.
2000-09-19 16:22:10 +00:00
Barry Warsaw 7158126673 Fixed the error reporting (raise of TestFailed) for the zip() and
zip(None) tests.  Found by Finn Bock a while ago.
2000-09-19 14:42:09 +00:00
Martin v. Löwis 6df27f8d1c Support sizehint in _fileobject.readlines, as documented. 2000-09-19 11:25:58 +00:00
Thomas Heller 543f2438ba Set the 'nt' installation scheme for the install command even if run
on other systems, so that data, headers, scripts are included in
the installer.
2000-09-19 11:10:23 +00:00
Martin v. Löwis a05fa1d9d4 Support sizehint in StringIO.readlines, as documented. 2000-09-19 11:07:44 +00:00
Guido van Rossum a3c6a8a30e Patch #101121, by Ka-Ping Yee: cosmetic cleanup of cgi.py, using my
style conventions.  (Ping has checkin privileges but apparently
ignores them at the moment.)

Ping improves a few doc strings and fixes style violations like foo ( bar ).

An addition of my own: rearrange the printing of various items in
test() so that the (long) environment comes at the end.  This avoids
having to scroll if you want to see the current directory or command
line arguments.
2000-09-19 04:11:46 +00:00
Guido van Rossum e7d6b0a22e An honest attempt to make this work on Unix, Windows, and even
Macintosh (the latter untested).

This closes Bug #110839.
2000-09-19 04:01:01 +00:00
Guido van Rossum d9a8e96543 Only supply popen2, popen3 when fork exists.
(This avoids defining non-working versions of these on the Mac.)
2000-09-19 03:04:52 +00:00
Jeremy Hylton 30f867423a Do not close socket when a Content-Length is 0. This make the
interface consistent: The client is responsible for closing the
socket, regardless of the amount of data received.

Restore suport for set_debuglevel call.
2000-09-18 22:50:38 +00:00
Paul Prescod 69cc7153c6 Test output that goes with updated test_minidom. 2000-09-18 20:44:15 +00:00
Fred Drake fd64c5908f Fix serious typo!
Add the new constants to the module docstring.
2000-09-18 19:38:11 +00:00
Paul Prescod 10d27660c9 Change assertions to confirmations so that optimization doesn't disable
checks.
2000-09-18 19:07:26 +00:00
Fred Drake 57a4e90922 Fix up the cleanup of the temporary DB so it works for BSD DB's
compatibility layer as well as "classic" ndbm.
2000-09-18 17:56:58 +00:00
Fred Drake a12adfe485 Reduce the number of imports needed.
Make the code conform better to the Python style guide.
2000-09-18 17:40:22 +00:00
Fred Drake 6b2320fa6b Richard Mortier <rmm1002@users.sourceforge.net>:
Add the constants "printable" and "punctuation" to the string module.
2000-09-18 16:46:17 +00:00
Fred Drake 6f6d51d050 Remove two unnecessary imports.
Update the module docstring to reflect the actual list of modules in the
xml.sax package.

Make the code better conform to the Python style guide.
2000-09-18 16:31:08 +00:00
Fred Drake c40cdf7238 Once we're done with the sys module, remove it from the namespace so
this module is "import *" safe.
2000-09-18 16:22:30 +00:00
Marc-André Lemburg 09cad08d75 sys.setdefaultencoding() should only be called in case the standard
default encoding ("ascii") is changed. This safes quite a few cycles
during startup since the first call to .setdefaultencoding() will
initialize the codec registry and the encodings package.

See python-dev for a discussion (Subject: "[Python-Dev] [comp.lang.python] sys.setdefaultencoding (2.0b1)").
2000-09-18 11:06:00 +00:00
Greg Ward 9082cdd009 Catch up to recent changes in TextFile (spotted by Bastian Kleineidam). 2000-09-18 00:41:10 +00:00
Greg Ward df9e6b8196 Fixed to respect 'define_macros' and 'undef_macros' on Extension object. 2000-09-17 00:54:58 +00:00
Greg Ward d283ce7364 Added 'expand_makefile_vars()' to (duh) expand make-style variables
in a string (gives you something to do with the dictionary returned
  by 'parse_makefile()').
Pulled the regexes in 'parse_makefile()' out -- they're now globals,
  as 'expand_makefile_vars()' needs (two of) them.
Cosmetic tweaks to 'parse_makefile()'.
2000-09-17 00:53:02 +00:00
Greg Ward 41ed12ffe9 Added 'read_setup_file()' to read old-style Setup files. Could make life
easier for people porting Makefile.pre.in-based extensions to Distutils.
Also loosened argument-checking in Extension constructor to make life
  easier for 'read_setup_file()'.
2000-09-17 00:45:18 +00:00
Tim Peters 077a11dd00 arraymodule: Fix SF bug 113960.
reverse() didn't work at all due to bad arg check.
    Fixed that.
    Added Brad Chapman to ACKS file, as the proud new owner of two
        implicitly copyrighted lines of Python source code <wink>.
    Repaired buffer_info's total lack of arg-checking.
    Replaced memmove by memcpy in reverse() guts, as memmove is
        often slower and the memory areas are guaranteed disjoint.
    Replaced poke-and-hope unchecked decl of tmp buffer size by
        assert-checked larger tmp buffer.
    Got rid of inconsistent spaces before open paren in docstrings.
    Added reverse() sanity tests to test_array.py.
2000-09-16 22:31:29 +00:00
Guido van Rossum 57d51f2f1d Improve the test output a bit. 2000-09-16 21:16:01 +00:00
Greg Ward acff0b3f3b Changed so lines that are all comment (or just whitespace + comment)
are completely skipped, rather than being treated as blank lines
(and then subject to the 'skip_blanks' flag).  This allows us
to process old-style Setup files, which rely on
  hello \\
  # boo!
  there
coming out as "hello there".
2000-09-16 18:33:36 +00:00
Greg Ward 3d05c16003 Andrew Kuchling:
Fixed precendence bug that meant setting skip_blanks to false didn't work
under some circumstances.
2000-09-16 18:09:22 +00:00
Greg Ward f11296bdea [change from 2000/08/11, propagating now to distutils copy]
Factored the guts of 'warn()' out to 'gen_error()', and added the
'error()' method (trivial thanks to the refactoring).
2000-09-16 18:06:31 +00:00
Greg Ward 60cd2864fe [change from 2000/04/17, propagating now to distutils copy]
Dropped the 'collapse_ws' option and replaced it with 'collapse_join' --
it's *much* faster (no 're.sub()') and this is the reason I really added
'collapse_ws', ie. to remove leading whitespace from a line being joined
to the previous line.
2000-09-16 18:04:55 +00:00
Greg Ward beb6d72f31 Rene Liebscher: if we have to run the same sub-command multiple times
(eg. "bdist_dumb", to generate both ZIP and tar archives in the same
run), tell all but the last run to keep temp files -- this just gets
rid of the need to pseudo-install the same files multiple times.
2000-09-16 16:04:59 +00:00
Greg Ward 3bfc8c8068 Renamed --keep-tree to --keep-temp. 2000-09-16 15:56:32 +00:00