Commit Graph

5537 Commits

Author SHA1 Message Date
Tim Peters 6d30c3e391 Change new tests to use integer division (// instead of /). 2001-12-05 00:30:09 +00:00
Tim Peters a3c01ce696 SF bug #488480: integer multiply to return -max_int-1.
int_mul():  new and vastly simpler overflow checking.  Whether it's
faster or slower will likely vary across platforms, favoring boxes
with fast floating point.  OTOH, we no longer have to worry about
people shipping broken LONG_BIT definitions <0.9 wink>.
2001-12-04 23:05:10 +00:00
Ka-Ping Yee fa78d0fbe4 Add "file" argument to Hook constructor.
By default, save sys.stdout in self.file when a Hook instance is created
    (e.g. when cgitb.enable() is called).
2001-12-04 18:45:17 +00:00
Guido van Rossum 4b402f2074 Address SF patch #485789 (Stefan Schwarzer).
$BROWSER should be split on os.pathsep, not on ":".
2001-12-04 17:43:22 +00:00
Guido van Rossum 6b70599450 Fix SF bug #486144: Uninitialized __slot__ vrbl is None.
There's now a new structmember code, T_OBJECT_EX, which is used for
all __slot__ variables (except __weakref__, which has special behavior
anyway).  This new code raises AttributeError when the variable is
NULL rather than converting NULL to None.
2001-12-04 16:23:42 +00:00
Guido van Rossum bb8f59a371 unpack_iterable(): Add a missing DECREF in an error case. Reported by
Armin Rigo (SF bug #488477).  Added a testcase to test_unpack_iter()
in test_iter.py.
2001-12-03 19:33:25 +00:00
Barry Warsaw c44d2c52c9 decode(), encode(): Accepting the minor optimizations from SF patch
#486375, but not the rest of it, since that changes the documented
semantics of encode().
2001-12-03 19:26:40 +00:00
Fred Drake 248b04383f Convert to using string methods instead of the string module.
In goahead(), use a bound version of rawdata.startswith() since we use the
same method all the time and never change the value of rawdata.  This can
save a lot of bound method creation.
2001-12-03 17:09:50 +00:00
Fred Drake 073148c4ef Add a test that makes sure unclosed entity references are handled consitently. 2001-12-03 16:44:09 +00:00
Guido van Rossum dbb53d9918 Fix of SF bug #475877 (Mutable subtype instances are hashable).
Rather than tweaking the inheritance of type object slots (which turns
out to be too messy to try), this fix adds a __hash__ to the list and
dict types (the only mutable types I'm aware of) that explicitly
raises an error.  This has the advantage that list.__hash__([]) also
raises an error (previously, this would invoke object.__hash__([]),
returning the argument's address); ditto for dict.__hash__.

The disadvantage for this fix is that 3rd party mutable types aren't
automatically fixed.  This should be added to the rules for creating
subclassable extension types: if you don't want your object to be
hashable, add a tp_hash function that raises an exception.

Also, it's possible that I've forgotten about other mutable types for
which this should be done.
2001-12-03 16:32:18 +00:00
Guido van Rossum cb33165ca2 _tryorder should always be a list, then the problem Jack had to fix in
1.24 wouldn't have occurred in the first place.

Remove a debug print command accidentally inserted by Martin in 1.23.
2001-12-03 15:51:31 +00:00
Jack Jansen 55c5abb52f Missing comma in tuple initializer caused webbrowser.open() not to work at
all in MacPython. (why did noone ever notice this?)
2001-12-03 15:44:17 +00:00
Guido van Rossum 5b443c6282 Address SF patch #480716 as well as related issues.
SF patch #480716 by Greg Chapman fixes the problem that super's
__get__ method always returns an instance of super, even when the
instance whose __get__ method is called is an instance of a subclass
of super.

Other issues fixed:

- super(C, C()).__class__ would return the __class__ attribute of C()
  rather than the __class__ attribute of the super object.  This is
  confusing.  To fix this, I decided to change the semantics of super
  so that it only applies to code attributes, not to data attributes.
  After all, overriding data attributes is not supported anyway.

- While super(C, x) carefully checked that x is an instance of C,
  super(C).__get__(x) made no such check, allowing for a loophole.
  This is now fixed.
2001-12-03 15:38:28 +00:00
Steven M. Gava 17d0154097 further work on new configuration system, specifically,
on keybinding configuration
2001-12-03 00:37:28 +00:00
Jack Jansen 398c236c1b Added tests expected to be skipped on Mac OS X. 2001-12-02 21:41:36 +00:00
Martin v. Löwis 95b057e3ea Patch #487784: Support Unicode commands in popen3/4 handling on UNIX. 2001-12-02 13:32:15 +00:00
Martin v. Löwis 79d802d58c Patch #487275: Add windows-1251 charset alias. 2001-12-02 12:24:19 +00:00
Martin v. Löwis 8b6bd42e08 Patch #487455: make types.StringTypes a tuple. 2001-12-02 12:08:06 +00:00
Tim Peters 82285dad8e Whitespace normalization. 2001-12-01 04:11:16 +00:00
Fred Drake 7fd173bfc4 Synchronize with pulldom from PyXML (revision 1.18). 2001-11-30 22:22:26 +00:00
Fred Drake 49a5d03ab4 Synchronize with minidom from PyXML (revision 1.35). 2001-11-30 22:21:58 +00:00
Fred Drake bd34b6bc3d Added the convenience constants that are present in PyXML to make these
more similar.
2001-11-30 15:37:33 +00:00
Jack Jansen b3be216b41 Merged changes made on r22b2-branch between r22b2 and r22b2-mac (the
changes from start of branch upto r22b2 were already merged, of course).
2001-11-30 14:16:36 +00:00
Guido van Rossum 42f5332f6d canonic(): don't use abspath() for filenames looking like <...>; this
fixes the problem reported in SF bug #477023 (Jonathan Mark): "pdb:
unexpected path confuses Emacs".
2001-11-29 02:50:15 +00:00
Tim Peters d15f8bbe32 SF bug 486480: zipfile __del__ is broken
ZipFile.__del__():  call ZipFile.close(), like its docstring says it does.
ZipFile.close():  allow calling more than once (as all file-like objects
in Python should support).
2001-11-28 23:16:40 +00:00
Marc-André Lemburg 41f01994c4 Adding test for Unicode repr()-output. 2001-11-28 14:03:14 +00:00
Barry Warsaw 00859c0538 __format(): Applied SF patch #482003 by Skip to fix multiline dict
output.

Patch includes additional test case test_basic_line_wrap().

This patch is a candidate for Python 2.1.2.
2001-11-28 05:49:39 +00:00
Jeremy Hylton 57911ae35a Fix [ #484645 ] little bug in pycodegen.py 2001-11-27 23:35:10 +00:00
Barry Warsaw e274864004 test_formatdate(): Integrating Jack's 22b2 branch fix for Mac epoch:
More changes to the formatdate epoch test: the Mac epoch is in
    localtime, so east of GMT it falls in 1903:-( Changed the test to
    obtain the epoch in both local time and GMT, and do the right
    thing in the comparisons. As a sanity measure also check that
    day/month is Jan 1.
2001-11-27 07:12:35 +00:00
Tim Peters dc47a89ff1 SF patch 483059: Avoid use of eval() in random.py, from Finn Bock.
_verify():  Pass in the values of globals insted of eval()ing their
names.  The use of eval() was obscure and unnecessary, and the patch
claimed random.py couldn't be used in Jython applets because of it.
2001-11-25 21:12:43 +00:00
Martin v. Löwis 652e1917c6 Properly set static options for tixBalloon and tixResizeHandle.
Expose Tix.ResizeHandle.{detach_widget,hide,show}.
Update Tix demos.
2001-11-25 14:50:56 +00:00
Martin v. Löwis 3a89b2b131 Patch #484847: Default to netscape.exe on OS/2. 2001-11-25 14:35:58 +00:00
Guido van Rossum 90c45142d7 - Change all remaining assertions into verify() and vereq() calls.
- Add tests for the recent fixes to copy_reg.py:
  __getstate__/__setstate__ and mixed inheritance from new+classic
  classes.
2001-11-24 21:07:01 +00:00
Guido van Rossum 00fb0c954f _reduce():
- Fix for SF bug #482752: __getstate__ & __setstate__ ignored (by Anon.)

    In fact, only __getstate__ isn't recognized.  This fixes that.

  - Separately, the test for base.__flags__ & _HEAPTYPE raised an
    AttributeError exception when a classic class was amongst the
    bases.  Fixed this with a hasattr() bandaid (classic classes never
    qualify as the "hard" base class anyway, which is what the code is
    trying to find).
2001-11-24 21:04:31 +00:00
Barry Warsaw bf7c52c233 More typo fixes. 2001-11-24 16:56:56 +00:00
Greg Ward 6253c2dd40 Docstring typo fix. 2001-11-24 15:49:53 +00:00
Steven M. Gava 8c1ab14ada fix for redundant empty parent window when invoked from idle shell window 2001-11-21 05:58:24 +00:00
Steven M. Gava 3b55a891a1 back in harness on new config system 2001-11-21 05:56:26 +00:00
Marc-André Lemburg 72f8213ba4 Fix for bug #438164: %-formatting using Unicode objects.
This patch also does away with an incompatibility between Jython
and CPython.
2001-11-20 15:18:49 +00:00
Marc-André Lemburg 0c4d8d05a8 Fix for bug #480188: printing unicode objects 2001-11-20 15:17:25 +00:00
Barry Warsaw 4586d2c91c test_formatdate(): Remove the unnecessary ldate calculation.
test_formatdate_zoneoffsets() => test_formatdate_localtime(): Do the
sign corrected calculation of the zone offset.
2001-11-19 18:38:42 +00:00
Barry Warsaw e5739a69a7 formatdate(): Jason Mastaler correctly points out that divmod with a
negative modulus won't return the right values.  So always do positive
modulus on an absolute value and twiddle the sign as appropriate after
the fact.
2001-11-19 18:36:43 +00:00
Barry Warsaw 75a40fcc3a test_formatdate(), test_formatdate_zoneoffsets(): Two changes. First,
use the correct way to test for epoch, by looking at the year
component of gmtime(0).  Add clause for Unix epoch and Mac epoch (Tim,
what is Windows epoch?).

Also, get rid of the strptime() test, it was way too problematic given
that strptime() is missing on many platforms and issues with locales.
Instead, simply test that formatdate() gets the numeric timezone
calculation correct for the altzone and timezone.
2001-11-19 16:31:06 +00:00
Barry Warsaw cd45a36959 formatdate(): The calculation of the minutes part of the zone was
incorrect for "uneven" timezones.  This algorithm should work for even
timezones (e.g. America/New_York) and uneven timezones (e.g.
Australia/Adelaide and America/St_Johns).

Closes SF bug #483231.
2001-11-19 16:28:07 +00:00
Barry Warsaw 7a1bea64f8 test_formatdate(): A test that has a mild hope of working on Mac,
which has a different epoch than *nix.  Jack may need to twiddle the
details.
2001-11-18 23:15:58 +00:00
Fred Drake 5751a22ede Fix parsing of parameters from a URL; urlparse() did not check that it only
split parameters from the last path segment.  Introduces two new functions,
urlsplit() and urlunsplit(), that do the simpler job of splitting the URL
without monkeying around with the parameters field, since that was not being
handled properly.
This closes bug #478038.
2001-11-16 02:52:57 +00:00
Barry Warsaw bf4d959d28 Two changes:
load_inst(): Implement the security hook that cPickle already had.
When unpickling callables which are not classes, we look to see if the
object has an attribute __safe_for_unpickling__.  If this exists and
has a true value, then we can call it to create the unpickled object.
Otherwise we raise an UnpicklingError.

find_class(): We no longer mask ImportError, KeyError, and
AttributeError by transforming them into SystemError.  The latter is
definitely not the right thing to do, so we let the former three
exceptions simply propagate up if they occur, i.e. we remove the
try/except!
2001-11-15 23:42:58 +00:00
Tim Peters 144b98dab8 More simple test cases for mixed classic+new multiple inheritance. 2001-11-14 23:56:45 +00:00
Tim Peters a91e9646e0 Changing diapers reminded Guido that he wanted to allow for some measure
of multiple inheritance from a mix of new- and classic-style classes.
This is his patch, plus a start at some test cases from me.  Will check
in more, plus a NEWS blurb, later tonight.
2001-11-14 23:32:33 +00:00
Tim Peters 00cafa0f76 Removed print that executes only on Unix boxes; that made it impossible
to have single "expected output" file.
2001-11-13 23:39:47 +00:00
Tim Peters 5ebfd36afa CVS patch #477161: New "access" keyword for mmap, from Jay T Miller.
This gives mmap() on Windows the ability to create read-only, write-
through and copy-on-write mmaps.  A new keyword argument is introduced
because the mmap() signatures diverged between Windows and Unix, so
while they (now) both support this functionality, there wasn't a way to
spell it in a common way without introducing a new spelling gimmick.
The old spellings are still accepted, so there isn't a backward-
compatibility issue here.
2001-11-13 23:11:19 +00:00
Jeremy Hylton 79b5b5b7fb Don't munge __debug__ and leave it that way. 2001-11-13 22:03:20 +00:00
Tim Peters 8876848323 Whitespace normalization. 2001-11-13 21:51:26 +00:00
Barry Warsaw 135cce8718 A specific test for bug #481221, getaddrlist() failing on long
addresses.  Commented out because it still takes too long to run.
2001-11-13 21:33:52 +00:00
Barry Warsaw f1fd282f13 Fix for bug #481221, getaddrlist() failing on long addresses. 2001-11-13 21:30:37 +00:00
Barry Warsaw 3ca656f1be Committing the second part of patch #480902, an improved test suite
for dumbdbm.py, by Skip Montanaro.  The first half of Skip's patch has
been postponed until Py2.3 since it adds new features.
2001-11-13 20:16:52 +00:00
Barry Warsaw 19c10caaa4 Add tests for bug #478115, parsedate_tz() IndexError when a Date:
field exists with an empty value.
2001-11-13 18:01:37 +00:00
Barry Warsaw 4a106ee9e1 parsedate_tz(): If data is false, return None. Fixes bug #478115,
IndexError when a Date: field exists with an empty value.
2001-11-13 18:00:40 +00:00
Jack Jansen 92c2ebf1b2 The libraries argument was completely ignored, fixed. Reported by
Tom Loredo.
2001-11-10 23:20:22 +00:00
Barry Warsaw 4279346a9f getnameinfo() appears to raise socket.error instead of
socket.gaierror. :( This allows test_socket to pass on a RH6.1-ish
Linux system.
2001-11-09 20:37:43 +00:00
Jeremy Hylton 8edd5402f0 Fix SF buf #480096: Assign to __debug__ still allowed
Easy enough to catch assignment in the compiler.  The perverse user
can still change the value of __debug__, but that may be the least he
can do.
2001-11-09 20:37:13 +00:00
Jeremy Hylton 778e265462 Fix SF buf #480096: Assign to __debug__ still allowed
Easy enough to catch assignment in the compiler.  The perverse user
can still change the value of __debug__, but that may be the least he
can do.
2001-11-09 19:50:08 +00:00
Jeremy Hylton 734c7fb131 Fiddle with new test cases -- verify that we get a sensible error
message for bad mode argument -- so that it doesn't fail on Windows.

It's hack.  We know that errno is set to 0 in this case on Windows, so
check for that specifically.
2001-11-09 19:34:43 +00:00
Barry Warsaw a4e5c71962 test_formatdate(): Dang. Typo. 2001-11-09 19:31:34 +00:00
Barry Warsaw 7edd71a9f5 test_formatdate(): Don't do the localtime test if we don't have
strptime() -- I'm too lazy to code it otherwise.
2001-11-09 19:30:58 +00:00
Barry Warsaw 75edc6a033 test_formatdate(): A test for email.Utils.formatdate(). 2001-11-09 17:46:17 +00:00
Barry Warsaw 9aa6435398 Forgot to import time. 2001-11-09 17:45:48 +00:00
Barry Warsaw 9cff0e604a formatdate(): A better docstring. 2001-11-09 17:07:28 +00:00
Barry Warsaw aa79f4d492 formatdate(): An implementation to replace the one borrowed from
rfc822.py.  The old rfc822.formatdate() produced date strings using
obsolete syntax.  The new version produces the preferred RFC 2822
dates.

Also, an optional argument `localtime' is added, which if true,
produces a date relative to the local timezone, with daylight savings
time properly taken into account.
2001-11-09 16:59:56 +00:00
Jeremy Hylton 52a17becbc Fix SF bug 468948 & 451295: urllib2 authentication problems
Fix contributed by Jeffrey C. Ollie.

I haven't tested the fix because the situation is non-trivial to
reproduce.

The basic solution is to get rid of the __current_realm attribute of
authentication handlers.  Instead, prevent infinite retries by
checking for the presence of an Authenticate: header in the request
object that exactly matches the Authenticate: header that would be
added.

The problem prevent authentication from working correctly in the
presence of retries.

Ollie mentioned that digest authentication has the same problem and I
applied the same solution there.
2001-11-09 16:46:51 +00:00
Jeremy Hylton 6383c2d1a6 Fix SF bug #479186: compiler generates bad code for "del"
Fix by Neil Schemenauer.  Visit the Subscript node when trying to find
the operation for a statement.

XXX Not sure if there are other nodes that should be visited.
2001-11-09 16:24:34 +00:00
Jeremy Hylton 41c8321252 Fix SF buf #476953: Bad more for opening file gives bad msg.
If fopen() fails with EINVAL it means that the mode argument is
invalid.  Return the mode in the error message instead of the
filename.
2001-11-09 16:17:24 +00:00
Jeremy Hylton 20747fa167 A better new, unique object 2001-11-09 16:15:04 +00:00
Martin v. Löwis bc0ad2d1a4 Merge directory chooser into tkFileDialog. 2001-11-08 17:51:33 +00:00
Fred Drake d5214b04f5 Clean up one comment, fix typos in others. 2001-11-08 17:19:29 +00:00
Martin v. Löwis 25ee87cc50 Patch #478654: Expose tk_chooseDirectory.
Also delegate kw arguments through ** calls.
2001-11-07 22:38:08 +00:00
Fred Drake 752eda459a Add a regression test for SF bug #478536: If a value cannot be weakly
referenced, WeakKeyDictionary.has_key() should return 0 instead of raising
TypeError.
2001-11-06 16:38:34 +00:00
Fred Drake 3bae7ddf8e WeakKeyDictionary.has_key(): If the key being tested is not weakly
referencable (weakref.ref() raises TypeError), return 0 instead of
propogating the TypeError.
This closes SF bug #478536; bugfix candidate.
2001-11-06 16:36:53 +00:00
Tim Peters e5a611c1bc A couple more test cases to ensure join() doesn't add an "extra" backslash
in the presence of empty-string arguments.
2001-11-05 21:33:04 +00:00
Tim Peters 6a3e5f14a6 SF bug 478425: Change in os.path.join (ntpath.py)
ntpath.join('a', '') was producing 'a' instead of 'a\\' as in 2.1.
Impossible to guess what was ever *intended*, but since split('a\\')
produces ('a', ''), I think it's best if join('a', '') gives 'a\\' back.
2001-11-05 21:25:02 +00:00
Barry Warsaw 2a9e3852ee walk(): Fix docstring; traversal is depth-first. Closes mimelib bug
#477864.
2001-11-05 19:19:55 +00:00
Fred Drake 526286725d Add regression test for SF bug #476616 -- make sure copy of a derived class
does not share data with the original.
2001-11-05 17:41:48 +00:00
Fred Drake 3ce5af70e3 copy(): Make sure the copy of a derived class cannot share the data of the
original by replacing self.data temporarily, then using the update() method
on the new mapping object to populate it.
This closes SF bug #476616.
2001-11-05 17:40:48 +00:00
Steven M. Gava d0342cdefa new config implementation 2001-11-04 11:53:10 +00:00
Steven M. Gava 9930061ce2 further config system work 2001-11-04 07:03:08 +00:00
Barry Warsaw ebf5427bfa Two bug fixes for problems reported by Sverre:
__getaddr(): Watch out for empty addresses that can happen when
something like "MAIL FROM:<CR>" is received.  This avoids the
IndexError and rightly returns an SMTP syntax error.

parseargs(): We didn't handle the 2-arg case where both the localspec
and the remotespec were provided on the command line.
2001-11-04 03:04:25 +00:00
Tim Peters 7533587d43 Improved error msg when a symbolic group name is redefined. Added docs
and NEWS.  Bugfix candidate?  That's a dilemma for Anthony <wink>:  /F
did fix a longstanding bug here, but the fix can cause code to raise an
exception that previously worked by accident.
2001-11-03 19:35:43 +00:00
Steven M. Gava c034b47ef3 added ability to set hilightthickness 2001-11-03 14:55:47 +00:00
Steven M. Gava 9dd16b3443 further config system work 2001-11-03 14:54:25 +00:00
Steven M. Gava e16d94b77e more work to support new config system 2001-11-03 05:07:28 +00:00
Martin v. Löwis b7b3260128 Patch #471120: Improved doc strings and new wrappers. 2001-11-02 23:48:20 +00:00
Martin v. Löwis 06b1d21e7d Correct getnameinfo refcounting and tuple parsing. Fixes #476648. 2001-11-02 23:34:52 +00:00
Andrew M. Kuchling f792bba98f [Patch #477336] Add an extensive PyUnit based testsuite for the hmac
module
2001-11-02 21:49:59 +00:00
Andrew M. Kuchling 1ccdff90bb [Patch #477336] Make hmac.py match PEP247, and fix the copy method() so that
it works
2001-11-02 21:49:20 +00:00
Andrew M. Kuchling a0b6035a54 [Patch #476612] Add test suite for PEP247 compliance 2001-11-02 21:46:17 +00:00
Andrew M. Kuchling a2085cb7f7 Fix comment typo 2001-11-02 21:45:39 +00:00
Fredrik Lundh 8a0232d84f SF bug #476912: flag repeated use of the same groupname as
the error it really is (and always has been)
2001-11-02 13:59:51 +00:00
Fred Drake 49cc01e552 Brute-force performance hackery; buys back about 20% of the time for
saferepr(), a bit less for pformat().
2001-11-01 17:50:38 +00:00
Chui Tey 8a7b4fa6d2 Documentation patches by bsherwood 2001-10-31 10:40:28 +00:00
Tim Peters 59ed448bc6 SF patch #474485: pydoc generates some bad html, from Rich Salz. 2001-10-31 04:20:26 +00:00