Commit Graph

8512 Commits

Author SHA1 Message Date
Jeremy Hylton 8501466c7f Change warnings to avoid importing re module during startup.
Add API function simplefilter() that does not create or install
regular expressions to match message or module.  Extend the filters
data structure to store None as an alternative to re.compile("").

Move the _test() function to test_warnings and add some code to try
and avoid disturbing the global state of the warnings module.
2003-07-11 15:37:59 +00:00
Andrew MacIntyre a1e93e8dfc patch #766650 - whichdb not identifying dbm DBs when dbm linked with gdbm
At this point, the problem appears particular to the OS/2 EMX port of
gdbm (which is at v1.7.3) - this combination produces a .pag file but
no .dir file.

A more sophisticated patch which checks magic numbers when dbm.library
indicates that dbm is linked to gdbm, and there is no .dir file, is
still attached to the above patch entry for reconsideration after 2.3
is released.

This checkin applies a workaround specific to the known failure case.
2003-07-11 12:16:48 +00:00
Just van Rossum c4bf893952 [ 767645 ] correctly set the os.path.supports_unicode_filenames flag for OSX 2003-07-11 07:36:49 +00:00
Tim Peters ef6573e529 __setitem__: Use integer division for computing # of blocks. 2003-07-11 04:09:55 +00:00
Tim Peters 663d1b61cb Added a new randomized test. 2003-07-11 04:09:09 +00:00
Just van Rossum ed8bfce002 Fixed a bug that's been there from the beginning but wasn't noticed
until now: the inheritance of default values was the wrong way around.
This caused app bundles to get a type of "BNDL" instead of "APPL".
Apparently this is not a problem until you try to drag your app to
the dock.
----------------------------------------------------------------------
2003-07-10 14:53:27 +00:00
Just van Rossum 87316ec962 don't optimize empty strings 2003-07-10 14:26:06 +00:00
Jeremy Hylton aefae5570d Fix wrong header name. The framework looks for auth_header. 2003-07-10 13:30:12 +00:00
Andrew MacIntyre 71d74e87cb Extend the pwd & grp emulations to support accessing the pwd/grp
record tuple by name as well as index, to match the behaviour of
the pwd/grp extension modules for Unix.  These emulation modules
now pass test_pwd & test_grp.
2003-07-10 12:52:54 +00:00
Raymond Hettinger 931237e2e6 SF patch #768187: replace apply(f, args, kwds) with f(*args, **kwds) 2003-07-09 18:48:24 +00:00
Gregory P. Smith ad30fa03a4 fix to work on python <= 2.1 2003-07-09 05:33:14 +00:00
Gregory P. Smith df35beed40 bugfix: proper import bsddb exists below 2003-07-09 05:29:24 +00:00
Gregory P. Smith 455d46f0d9 bsddb 4.1.6:
* Extended DB & DBEnv set_get_returns_none functionality to take a
   "level" instead of a boolean flag.  The boolean 0 and 1 values still
   have the same effect.  A value of 2 extends the "return None instead
   of raising an exception" behaviour to the DBCursor set methods.
   This will become the default behaviour in pybsddb 4.2.
 * Fixed a typo in DBCursor.join_item method that made it crash instead
   of returning a value.  Obviously nobody uses it.  Wrote a test case
   for join and join_item.
2003-07-09 04:45:59 +00:00
Kurt B. Kaiser bea57c6c35 SF Bug 767794
"Break or continue outside loop causes crash"
2003-07-09 04:27:24 +00:00
Jeremy Hylton 121d34af19 Fix SF bug 764095: Don't use network in test_httplib. 2003-07-08 12:36:58 +00:00
Fred Drake b5aa407196 Use Boolean values for the capturestderr flag. 2003-07-07 21:36:19 +00:00
Jeremy Hylton d7ce86dcab Patch from Zooko to remove an experimental feature. 2003-07-07 16:08:47 +00:00
Tim Peters e5e065b669 New function sys.getcheckinterval(), to complement setcheckinterval(). 2003-07-06 18:36:54 +00:00
Just van Rossum be56aae36a #765903:
- added bundle_id/--bundle-id option, to specify the CFBundleIndentifier
#765615:
- in the appropriate situation, prepend $PATH with our path instead of
  setting it.
2003-07-04 14:20:03 +00:00
Jack Jansen bbaa083745 If a --python option is used to specify the Python to use in the #!
line also use this as the executable in the bundle.
2003-07-04 11:05:35 +00:00
Brett Cannon cde2200ff2 Fixes bug of timezone value being left as -1 when ``time.tzname[0] ==
time.tzname[1] and not time.daylight`` is true when it should only when
time.daylight is true.  Tests are also fixed.

Closes bug #763047 and its cohort #763052.
2003-07-03 19:59:57 +00:00
Just van Rossum 74902508dc Addendum to #764548: restore 2.1 compatibility. 2003-07-02 21:37:16 +00:00
Just van Rossum 12723bacea Fix and test for bug #764548:
Use isinstance() instead of comparing types directly, to enable
subclasses of str and unicode to be used as patterns.
Blessed by /F.
2003-07-02 20:03:04 +00:00
Just van Rossum 6802c6e764 fixed typo in comment 2003-07-02 14:36:59 +00:00
Andrew MacIntyre 348c261fe6 On those systems lacking the AFMT_S16_NE symbol, the test was failing
because it was still looking in the ossaudiodev module namespace for
this symbol.

As the symbol has already been rebound as a global, use that instead.
2003-07-02 14:05:08 +00:00
Neal Norwitz b7f6810a1f SF #764121, docstring for spawnlp incorrect 2003-07-02 02:49:33 +00:00
Neal Norwitz 3c0f2c91ad Fix SF bug #763637, 2.3b2 unpack tuple of wrong size in after_cancel
Tk 8.4 may return different values than 8.3.  This fix should handle
either version.
2003-07-01 21:12:47 +00:00
Just van Rossum bcc58e87e8 - added (c)StringIO tests; cStringIO usage failed in the previous
version of plistlib.py (r1.2)
2003-07-01 20:22:30 +00:00
Just van Rossum 94af32e244 - replaced a couple of asserts with proper exceptions
- use isinstance instead of flaky file-detection code
2003-07-01 20:15:38 +00:00
Tim Peters 59aba128a5 Make the classes exposed by threading.py new-style classes. This is
mostly for convenience and to aid debugging.
2003-07-01 20:01:55 +00:00
Tim Peters 0939fac795 Resolved minor XXX question in the obvious way. 2003-07-01 19:28:44 +00:00
Neal Norwitz e7dfe21bed Fix SF bug #763023, difflib.py: ratio() zero division not caught
Backport candidate
2003-07-01 14:59:46 +00:00
Tim Peters 37ca8c12dc connector(): You can't use an empty string as an argument to connect()
on Windows.
2003-07-01 14:49:32 +00:00
Neal Norwitz 1787a0b1cc Fix SF bug #763770, test_socket_ssl crash
Don't run any tests if there is no ssl support.
2003-07-01 13:44:28 +00:00
Raymond Hettinger cc0a664669 Test Brett's addition of __all__ to Queue. 2003-07-01 05:49:02 +00:00
Brett Cannon b42bb5a88a Add __all__ . 2003-07-01 05:34:27 +00:00
Neal Norwitz 168e73d25e Fix SF #763362, test_posixpath failed
Don't check expanduser('~') if the home directory == the root directory
(ie, we are running as root).
2003-07-01 03:33:31 +00:00
Neal Norwitz 3106817c68 Fix typo in error message 2003-06-30 19:22:12 +00:00
Walter Dörwald 8bcbe6aa7e Don't require that a RuntimeError is raised when playing a second
sound while the first one is still running, as the first one
one might already have finished.

Fixes part of SF bug #763052.
2003-06-30 11:57:52 +00:00
Raymond Hettinger d693a81595 Fix SF 762891: "del p[key]" on proxy object raises SystemError() 2003-06-30 04:18:48 +00:00
Neal Norwitz a9002f824b Fix SF #754870, SSL crash interpreter when remote side closes during connect
Also fix a memory leak.
2003-06-30 03:25:20 +00:00
Just van Rossum 79b0ae12fd restore 2.2 compatibility:
- don't use "abc" in aString
- don't reorganize extension modules when not using zipimport
2003-06-29 22:20:26 +00:00
Just van Rossum 762d2cce6f - added --semi-standalone option that builds apps that depend on an
installed Python, yet include any modules not in the std lib
- reworked extension module inclusion code: put all .so files in
  a subdirectory of Contents/Resources/, but more importantly,
  correctly support extensions that are submodules.
2003-06-29 21:54:12 +00:00
Raymond Hettinger 0242070d04 More tests
* Test with infinite inputs (using take() on the output)
* Test whether GC can find and eliminate cycles.
2003-06-29 20:36:23 +00:00
Jeremy Hylton b67695238d Fix sf bug 666219: assertion error in httplib.
The obvious way for this assertion to fail is if the LineAndFileWrapper constructor is called when an empty line.  Raise a BadStatusError before the call.
2003-06-29 17:55:05 +00:00
Tim Peters d1b108b953 Whitespace normalization. 2003-06-29 17:24:17 +00:00
Jeremy Hylton 89392c0005 Remove stub settrace() and setprofile() calls. 2003-06-29 17:07:46 +00:00
Jeremy Hylton e3a565eed0 Fix grammar in comment. 2003-06-29 16:59:59 +00:00
Jeremy Hylton 97b2e84d43 Whitespace normalization. 2003-06-29 16:59:43 +00:00
Jeremy Hylton bfccb35b58 Add settrace() and setprofile() functions to the threading library. 2003-06-29 16:58:41 +00:00
Tim Peters 685e69739e Provide dummy (do-nothing) settrace() and setprofile() functions until
Jeremy can check in the real things.
2003-06-29 16:50:06 +00:00
Raymond Hettinger b4e9986782 Removed invalid test.
Analysis by Bob Halley:

  The test seems to expect that if time.daylight is true, then the
  is_dst field of the tm structure will be 1 too.  But this isn't
  the case, since daylight is true if the timezone does DST, *not*
  if DST is in effect.
2003-06-29 15:57:50 +00:00
Raymond Hettinger 2b6220d88b SF bug #762455: Python segfaults when sys.stdout is changed in getattr
* Added unittest that fails before, but not after Neil's fix to ceval.c.
2003-06-29 15:44:07 +00:00
Tim Peters 478c10554b Whitespace normalization. 2003-06-29 05:46:54 +00:00
Tim Peters db3756dade Some nifty doctest extensions from Jim Fulton, currently used in Zope3.
I won't have time to write real docs, but spent a lot of time adding
comments to his code and fleshing out the exported functions' docstrings.
There's probably opportunity to consolidate how docstrings get extracted
too, and the new code for that is probably better than the old code for
that (which strained mightily to recover from 2.2's new class/type
gimmicks).
2003-06-29 05:30:48 +00:00
Raymond Hettinger e2f18377ff SF bug #430160: CGIHTTPServer.py POST bug using IE
Minor improvement to previous bugfix.
Eating the remaining characters would lead to an endless loop
without a termination test.
2003-06-29 05:06:56 +00:00
Neal Norwitz bc05fc5d2b Add missing self. before curNode. This may need to be committed
to PyXML, I'm not sure of the procedure.
2003-06-29 04:50:34 +00:00
Raymond Hettinger 11a35f545b SF patch #760257: add socket.timeout exception
(Contributed by Bob Halley)

Add unittests for the new socket.timeout exception.
2003-06-29 04:40:22 +00:00
Neal Norwitz 10f3018023 Fix arguments for instantiating InterpolationSyntaxError 2003-06-29 04:23:35 +00:00
Neal Norwitz b207170d39 Comment out cap, it was unused.
Should all the commented out code be removed?
2003-06-29 04:21:43 +00:00
Neal Norwitz 3f401f07e8 whitespace normalization 2003-06-29 04:19:37 +00:00
Neal Norwitz c556722f09 remove unused import math 2003-06-29 04:18:15 +00:00
Neal Norwitz 9b924c690e remove extra parameter from _java_getprop, remove duplicate imports 2003-06-29 04:17:45 +00:00
Neal Norwitz 77290f25f3 use == like all the other conditionals 2003-06-29 04:16:49 +00:00
Neal Norwitz 732911fd1e fix problems found by pychecker 2003-06-29 04:16:28 +00:00
Tim Peters 275abbd525 Missed a spot where the new optional optionflags argument needed to get
passed on.
2003-06-29 03:11:20 +00:00
Jack Jansen c5991b0c02 Use http://www.python.org/packman as the base URL. Also upped the version
number because of this.
2003-06-29 00:09:18 +00:00
Raymond Hettinger 2dd1ed69b4 SF 662923: iterator for dbm keys
When shelve and the bsdbm where expanded to a full mapping interface,
this module was missed.
2003-06-28 07:08:39 +00:00
Raymond Hettinger 3567a876c7 Add take() to examples. Tighten the islice() example 2003-06-28 05:44:36 +00:00
Raymond Hettinger c0fac96c29 SF patch #756996: Bare except in ZipFile.testzip()
(Contributed by Steven Taschuk)

Replaces a bare except that caused all errors to be mis-reported as
archive errors.

Added a related NEWS item.
2003-06-27 22:25:03 +00:00
Raymond Hettinger 6f3eaa67e5 SF patch #761519: Fixes for bugs 760703 and 757821
SF bug #760703: SocketHandler and LogRecord don't work well together
SF bug #757821: logging module docs

Applied Vinay Sajip's patch with a few minor fixups and a NEWS item.

Patched __init__.py - added new function
makeLogRecord (for bug report 760703).

Patched handlers.py - updated some docstrings and
deleted some old commented-out code.

Patched test_logging.py to make use of makeLogRecord.

Patched liblogging.tex to fill documentation gaps (both
760703 and bug 757821).
2003-06-27 21:43:39 +00:00
Tim Peters 6ebe61fa80 A hack to ease compatibility with pre-2.3 Pythons: by default, doctest
now accepts "True" when a test expects "1", and similarly for "False"
versus "0".  This is un-doctest-like, but on balance makes it much
more pleasant to write doctests that pass under 2.2 and 2.3.  I expect
it to go away again, when 2.2 is forgotten.  In the meantime, there's
a new doctest module constant that can be passed to a new optional
argument, if you want to turn this behavior off.

Note that this substitution is very simple-minded:  the expected and
actual outputs have to consist of single tokens.  No attempt is made,
e.g., to accept [True, False] when a test expects [1, 0].  This is a
simple hack for simple tests, and I intend to keep it that way.
2003-06-27 20:48:05 +00:00
Gustavo Niemeyer 6cf26195c6 Do not add extra "\n" after bang line. 2003-06-27 19:33:38 +00:00
Fred Drake 01c623b1a3 fix typo 2003-06-27 19:22:11 +00:00
Skip Montanaro a7b8ac6613 add mention of -l, --listfuncs to usage() small part of 542562 2003-06-27 19:09:33 +00:00
Jeremy Hylton c4bf5edc3a Add a trivial test of getargspec() with a method. 2003-06-27 18:43:12 +00:00
Jeremy Hylton ab91902f6f A bit o' reformatting and removal of non-_getframe currentframe(). 2003-06-27 18:41:20 +00:00
Jeremy Hylton 6496788e7a Fix for SF bug 620190: getargspec() doesn't work with methods. 2003-06-27 18:14:39 +00:00
Jeremy Hylton 7ff55e6bc5 Add tests for __nonzero__() problems. 2003-06-27 17:40:16 +00:00
Jeremy Hylton f8ecde5de0 Revert previous checkin and just add a comment about constructor_ob.
There's no point to passing it anymore, but there's a test that
expects the call to fail if you pass a non-callable object.
2003-06-27 16:58:43 +00:00
Skip Montanaro 0fe8fce7e3 (HTML|Text)Repr.repr1: Guard against objects whos types have no __name__
attribute. Patch and bug report from Geoff Talvola. Closes patch #672855.
2003-06-27 15:45:41 +00:00
Michael W. Hudson 896e5164bb Jacob Hallen cornered me here at EuroPython and got me to look at
patch:

[ 750008 ] 'compiler' module bug with 'import foo.bar as baz'

which I'm now checking in.

after import foo.bar as baz, baz would refer to foo.
2003-06-27 12:32:39 +00:00
Raymond Hettinger f69d9f6818 SF bug #761337: datetime.strftime fails on trivial format string
The interning of short strings violates the refcnt==1 assumption for
_PyString_Resize().

A simple fix is to boost the initial value of "totalnew" by 1.
Combined with an NULL argument to PyString_FromStringAndSize(),
this assures that resulting format string is not interned.
This will remain true even if the implementation of
PyString_FromStringAndSize() changes because only the uninitialized
strings that can be interned are those of zero length.

Added a test case.
2003-06-27 08:14:17 +00:00
Jeremy Hylton 7567822838 Don't call constructor() from pickle().
The constructor() call only made sense when it registered the
constructor as safe for unpickling.  We should probably remove the
module-global function, but need to worry about backwards
compatibility.
2003-06-26 23:20:20 +00:00
Raymond Hettinger f6fe4eda6e Portion of SF patch #761104. Fixes a minor docstring error.
_TemporarilyImmutableSet is in fact a subclass of BaseSet
2003-06-26 18:49:28 +00:00
Jeremy Hylton 546e34b654 Enable tracing of multi-threaded applications.
Fix bug in computation of coverage percentage: Only count a line if it
was executed or if we print the >>>>>> marker.
2003-06-26 14:56:17 +00:00
Raymond Hettinger 5f078ff7f0 SF bug #759889: Pickling of Random is broken
* Implement __reduce__() to support pickling.
* Add a test case to prove a successful roundtrip through pickle.
2003-06-24 20:29:04 +00:00
Barry Warsaw 663219a8cc _make_boundary(): A minor optimization suggested by the Timbot. 2003-06-24 20:19:34 +00:00
Greg Stein 616a58d79a Deal with a couple XXX comments which asked questions.
In response to "shouldn't the client close the file?", the answer is
"no". The original design behind HTTPConnection is that the client did
not have to worry about it. The response would close itself when you
read the last of the data from it. This closing also dealt with
allowing the connection to perform another request/response (if it was
a persistent connection).

However... the auto-close behavior broke compatibility with the
classic httplib.HTTP class' behavior when a zero-length response body
was present. In that situation, the HTTPResponse object was
auto-closing it since there was no data present, and for an HTTP/1.0
connection-close socket (or an HTTP/0.9 request) connection, that also
ended up closing the socket. When an httplib.HTTP user went to read
the socket... boom. A patch to correct the auto-close (for compat with
old httplib users) was added in rev 1.22.

But for non-zero-length *chunked* bodies, we should keep the
auto-close behavior. The library user is not reading the socket (they
can't cuz of the chunked response we just got done handling), so they
should be immune to the response closing the socket. In fact, I would
like to see (one day) the auto-close restored, and the HTTP subclass
would simply have a flag to disable that behavior (for back-compat
purposes).
2003-06-24 06:35:19 +00:00
Raymond Hettinger 8a99b50239 SF patch #736962. Converted test_compile to unittest format. 2003-06-23 13:36:57 +00:00
Martin v. Löwis bcc651a1f9 Idlefork patch #682347: convert Unicode strings from readline to
IOBinding.encoding. Also set sys.std{in,out,err}.encoding, for both
the local and the subprocess case.
2003-06-22 07:52:56 +00:00
Just van Rossum ac8657bb0e some old changes to this unused module 2003-06-21 14:49:14 +00:00
Just van Rossum 35b50e2683 changed 8-space indentation to 4 2003-06-21 14:41:32 +00:00
Martin v. Löwis 5b8bfdf67c Patch #755087: Deal with emptied dumbdbm files correctly. 2003-06-21 13:54:55 +00:00
Just van Rossum dc31dc02f7 - do the right thing with symlinks inside directories we're copying
- move the normpath stuff around a bit
- added dubious special case to addPythonFramework()
2003-06-20 21:43:36 +00:00
Just van Rossum 6a55242685 make sure paths to dirs don't end in a / 2003-06-20 21:26:55 +00:00
Just van Rossum 00a0b97dc5 Reworked --strip option: it will now look at _any_ file that's marked
executable in the bundle. Therefore got rid of the "binaries" attribute.
2003-06-20 21:18:22 +00:00
Just van Rossum 9e50023898 register the library inside Python.framework as eligable for stripping 2003-06-20 20:05:40 +00:00
Just van Rossum 3166f59d2a Add initial standalone support for Python.framework 2003-06-20 18:56:10 +00:00
Raymond Hettinger 4327521688 Added regression test for SF #757818 2003-06-20 18:41:26 +00:00