Commit Graph

5748 Commits

Author SHA1 Message Date
Tim Peters 1422e9dc60 SF patch 493739 2 Bugfixes for 2.2c1 (RISC OS specific), from
Dietmar Schwertberger.
Bugfix candidate.
"""
RISCOS/Modules/getpath_riscos.c:
Include trailing '\0' when using strncpy [copy
strlen(...)+1 characters].

Lib/plat-riscos/riscospath.py:
Use riscosmodule.expand for os.path.abspath.
[fixes problems with site.py where
abspath("<Python$Dir>") returned
join(os.getcwd(), "<Python$Dir>") as e.g.
"SCSI::SCSI4.$.<Python$Dir>" because "<Python$Dir>"
wasn't recognised as an absolute path.]
"""
2001-12-15 22:12:47 +00:00
Guido van Rossum 796e1e0b30 Don't call resetwarnings(). Be more restrictive in what we filter out
instead.
2001-12-15 18:04:10 +00:00
Jack Jansen f839c27027 Added test_socketserver and test_unicode_file to tests expected to be
skipped on Mac OS X. Not sure yet about test_locale.py: this may be
due to my copy of Mac OS X (although it talks english fine enough).
2001-12-14 21:28:53 +00:00
Barry Warsaw 7675097d78 send(), ehlo(): Integrate patch #487310 by Fazal Majid. Consistently
call self.close() just before raising SMTPServerDisconnected.  This
allows you to, e.g. reconnect after a server timeout.

Merged from the 2.2c1 branch.
2001-12-14 20:34:20 +00:00
Jeremy Hylton 2a05bc72d6 Partial fix for problem in SF buf #487458
Rev 1.20 introduced a call to getpeername() in the dispatcher
constructor.  This only works for a connected socket.  Apparently
earlier versions of the code worked with un-connected sockets, e.g. a
listening socket.

It's not clear that the code is supposed to accept these sockets,
because it sets self.connected = 1 when passed a socket.  But it's
also not clear that it should be a fatal error to pass a listening
socket.

The solution, for now, is to put a try/except around the getpeername()
call and continue if it fails.  The self.addr attribute is used
primarily (only?) to produce a nice repr for the object, so it hardly
matters.  If there is a real error on a connected socket, it's likely
that subsequent calls will fail too.
2001-12-14 16:15:11 +00:00
Guido van Rossum e54616cb6f (Merge into trunk.)
Fix for SF bug #492345.  (I could've sworn I checked this in, but
apparently I didn't!)

This code:

    class Classic:
        pass

    class New(Classic):
        __metaclass__ = type

attempts to create a new-style class with only classic bases -- but it
doesn't work right.  Attempts to fix it so it works caused problems
elsewhere, so I'm now raising a TypeError in this case.
2001-12-14 04:19:56 +00:00
Jeremy Hylton f36cfef1ae Undo inadvertent change to test_scope in previous checkin 2001-12-13 20:00:26 +00:00
Fred Drake 68773e779a Add a comment explaining what these tests are for, and where to look for
tests of complex().
2001-12-13 19:57:53 +00:00
Fred Drake 526c7a0101 Ensure that complex() only accepts a string argument as the first arg,
and only if there is no second arg.
This closes SF patch #479551.
2001-12-13 19:52:22 +00:00
Jeremy Hylton 3095a4c228 Update output generated by test_scope 2001-12-13 19:47:51 +00:00
Jeremy Hylton ccae8377a3 Add test for SF bug [ #492403 ] exec() segfaults on closure's func_code 2001-12-13 19:45:04 +00:00
Fred Drake 723293cb49 Make tix_configure() work the same way configure() works for the basic
Tkinter classes.
Adjust a lot of docstrings.
Convert a few type checks to use isinstance() instead of type().
This is part of SF patch #485959.
2001-12-13 04:53:07 +00:00
Guido van Rossum 1990943095 Fix for SF #491953 (Andrew Dalke): ScrolledText.py has TabError
Untabified.
2001-12-12 12:47:57 +00:00
Fred Drake 1e7dfd3745 Wrapped a long line.
Converted to use "".startswith() to avoid slicing (& temp string creation).
2001-12-12 06:20:34 +00:00
Fred Drake d077ca1e7c Very small test suite for the calendar module, mostly to check a constraint
on the return values from isleap().  Also checks firstweekday() and
setfirstweekday().
2001-12-12 05:38:08 +00:00
Marc-André Lemburg 90294d01be Joe VanAndel wrote:
>
> When using 'distutils' (shipped with Python 2.1) I've found that my
> Python scripts installed with a first line of:
>
> #!/usr/bin/python2.1None
>
> This is caused by distutils trying to patch the first line of the python
> script to use the current interpreter.
2001-12-11 20:44:42 +00:00
Tim Peters 017052152b Fiddle test_class so it passes with -Qnew. 2001-12-11 19:28:47 +00:00
Tim Peters e93e477215 Fiddle test_augassign so it passes under -Qnew. 2001-12-11 19:20:15 +00:00
Martin v. Löwis df8adcd7ba Ignore SIGXFSZ. Fixes #490453. 2001-12-11 17:57:26 +00:00
Fred Drake d15db5c711 When using GCC, use the right option to add a directory to the list of dirs
searched for a dependency for runtime linking.
This closes SF bug #445902.
2001-12-11 05:04:24 +00:00
Guido van Rossum 29d260670e Additional coverage tests by Neil Norwitz.
(SF patch #491418, #491420, #491421.)
2001-12-11 04:37:34 +00:00
Fred Drake 2a64f4693d Regression test for SF bug #478534 -- exceptions could "leak" into a weakref
callback.
2001-12-10 23:46:02 +00:00
Finn Bock 2b29cb2593 Skipping some tests by adding the usual jython conditional test around:
- the repr of unicode. Jython only add the u'' if the string contains char
  values > 255.
- A unicode arg to unicode() is perfectly valid in jython.
- A test buffer() test. No buffer() on Jython

This closes patch "[ #490920 ] Jython and test_unicode".
2001-12-10 20:57:34 +00:00
Guido van Rossum 61d3637ff8 SF patch #491183 (Jeff Epler): ScrolledText.grid() doesn't work
Using grid methods on ScrolledText widgets does not
work as expected. It either fails to pack a widget, or
can even cause Tk to lock up.

The problem is that the .grid method is being called on
the text widget, not the frame widget. This can lead
to the well-known lockup in Tk when a frame's children
are managed by both the pack and grid managers. Even
if it doesn't lock up, the frame is never placed within
the intended widget.

Program fragment:
>>> import ScrolledText
>>> s = ScrolledText.ScrolledText()
>>> s.grid(row=0, column=0, rowspan=2)

The following patch uses the same hack to copy the
'grid' and 'place' geometry manager methods to the
ScrolledText instance as is already used for the 'pack'
manager.
2001-12-10 16:42:43 +00:00
Michael W. Hudson fb173cd471 Fix for
[ #409430 ] pydoc install broken
2001-12-10 16:15:44 +00:00
Michael W. Hudson 49bdaede1b Fix for
[ #477371 ] build_scripts can use wrong #! line

scripts now get "built" into a directory

build/scripts-$(PYTHON_VERSION)/
2001-12-10 15:28:30 +00:00
Finn Bock 793ead5696 A workaround for the missing buffer() builtin in jython.
This closes patch "[ #490850 ] Jython and test_StringIO".
2001-12-09 20:06:32 +00:00
Fredrik Lundh 82b230732f bug #133283, #477728, #483789, #490573
backed out of broken minimal repeat patch from July

also fixed a couple of minor potential resource leaks in pattern_subx
(Guido had already fixed the big one)
2001-12-09 16:13:15 +00:00
Finn Bock ed69aeedb9 test(): Avoid a UnboundLocalError when a method is missing from both the string
module and from string methods.

This closes patch "[ #490811 ] Jython and test_string".
2001-12-09 16:06:29 +00:00
Finn Bock d08011a0e1 Moved a print statement outside the jython platform test. Otherwise
the output fails to compare correctly for jython. This change was part
of the original patch #403666.
2001-12-09 10:19:25 +00:00
Finn Bock 4ab7adbd94 The initial patch #468662 was not applied quite verbatim. This should one
will fix the remaining Jython issues.

This closes patch "[ #490411 ] Jython and test_grammar.py".
2001-12-09 09:12:34 +00:00
Finn Bock ada1983950 Refcounting isn't available in Jython. Putting the jython test around it.
This closes patch "[ #490414 ] Jython and test_socket".
2001-12-09 08:57:46 +00:00
Guido van Rossum 146483964e Patch supplied by Burton Radons for his own SF bug #487390: Modifying
type.__module__ behavior.

This adds the module name and a dot in front of the type name in every
type object initializer, except for built-in types (and those that
already had this).  Note that it touches lots of Mac modules -- I have
no way to test these but the changes look right.  Apologies if they're
not.  This also touches the weakref docs, which contains a sample type
object initializer.  It also touches the mmap test output, because the
mmap type's repr is included in that output.  It touches object.h to
put the correct description in a comment.
2001-12-08 18:02:58 +00:00
Guido van Rossum b931bf3c55 SF patch #490515 (Joe A) urllib.open_https() protocol issue
open_http():
    In urllib.py library module, URLopener.open_https()
    returns a class instance of addinfourl() with its
    self.url property missing the protocol.

    Instead of "https://www.someurl.com", it becomes
    "://www.someurl.com".
2001-12-08 17:09:07 +00:00
Finn Bock aa3dc45658 Enable support for jython:
1. Acknowledge the welknown difference that jython
allows continue in the finally clause.

2. Avoid using _testcapi when running with jython.

This closes patch "[ #490417 ] Jython and test_exceptions"
2001-12-08 10:15:48 +00:00
Guido van Rossum baefcebb55 Remove erroneous and confusing comment -- sre patterns *can* be
pickled and we do *not* expect exceptions from either pickle or
cPickle.
2001-12-08 05:11:15 +00:00
Fred Drake 2c8373bc23 Honor the mode argument to dumbdbm.open(); there is not good reason not to,
especially since the documentation described it in detail.
This partially closes SF bug #490098.
2001-12-07 21:54:46 +00:00
Tim Peters cbfc0343fc SF patch 490393: test___all__ and Jython; from Finn Bock.
Don't even try to import _socket when running under Jython.
2001-12-07 21:35:42 +00:00
Guido van Rossum 78f0dd3397 I found that when run as a script, this test suite ran its tests
twice!  Fixed this by avoiding the import of test_email, which loads
the module a second time in that situation, and fiddled the __main__
section to resemble other test suites using unittest.
2001-12-07 21:07:08 +00:00
Finn Bock 71be984b80 Align the number of %s with the number of format arguments.
This closes patch "[ #490330 ] String format bug in test_b2."
2001-12-07 18:21:56 +00:00
Guido van Rossum a35e2cee32 Move import dbhash out of test_sundry and into test_bsddb,
so that test_sundry won't fail if the bsddb module is absent.
2001-12-07 16:43:19 +00:00
Guido van Rossum 202dd1ef42 In unconditional except clauses, don't catch KeyboardInterrupt -- it's
annoying that often you have to hit ^C numerous times before it
works.  The solution: before the "except:" clause, insert "except
KeyboardInterrupt: raise".  This propagates KeyboardInterrupt out,
stopping the test in its tracks.
2001-12-07 03:39:34 +00:00
Fred Drake 9028d0a525 Visious hackery to solve a build-control problem related to our use of
distutils for the library modules built as shared objects.  A better solution
appears possible, but with the threat that the distutils becomes more
magical ("complex").
This closes SF bug #458343.
2001-12-06 22:59:54 +00:00
Andrew M. Kuchling 3ecc1ce529 [Bug #475009] Tighten the pattern for the first line, so we don't
adjust it when a versioned interpreter is supplied (#!.../python2 ...)
2001-12-06 21:29:28 +00:00
Fred Drake 21d45356b8 Whitespace normalization. 2001-12-06 21:01:19 +00:00
Fred Drake b94b849d65 Whitespace normalization. 2001-12-06 20:51:35 +00:00
Thomas Heller bcd8975740 Use a version number of 0.0.0 instead of ???. The latter leads to
invalid filenames on Windows when building without specifying a
version number in the setup script.

See also
http://mail.python.org/pipermail/distutils-sig/2001-November/002656.html

Bugfix candidate.
2001-12-06 20:44:19 +00:00
Fred Drake 2998a55f2d Attribute nodes did not always get their ownerDocument and ownerElement
properly set.  This fixes that.
2001-12-06 18:27:48 +00:00
Fred Drake 6b04ffe9e5 Be more careful about accessing attributes of the parent: if Tk has not been
initialized, this will be None, but the functions will still work (there will
simply be a bogus parent on the screen).  Allowing the parent to be None
is useful when testing the functions from an interactive interpreter.

Add an optional keyword paramter "show" to the _QueryString class; when given
it is used to set the -show option to the entry widget.  This allows passing
show="*" or the like to askstring(), making it useful for requesting
passwords/passphrases from the user.
This closes SF bug #438517.

Changed a docstring to be less font-lock-hostile.
2001-12-06 16:51:41 +00:00
Andrew M. Kuchling d303b61eb4 [Bug #459270] Fix incorrect docstring 2001-12-06 16:32:05 +00:00
Tim Peters 3caca2326e SF bug #488514: -Qnew needs work
Big Hammer to implement -Qnew as PEP 238 says it should work (a global
option affecting all instances of "/").

pydebug.h, main.c, pythonrun.c:  define a private _Py_QnewFlag flag, true
iff -Qnew is passed on the command line.  This should go away (as the
comments say) when true division becomes The Rule.  This is
deliberately not exposed to runtime inspection or modification:  it's
a one-way one-shot switch to pretend you're using Python 3.

ceval.c:  when _Py_QnewFlag is set, treat BINARY_DIVIDE as
BINARY_TRUE_DIVIDE.

test_{descr, generators, zipfile}.py:  fiddle so these pass under
-Qnew too.  This was just a matter of s!/!//! in test_generators and
test_zipfile.  test_descr was trickier, as testbinop() is passed
assumptions that "/" is the same as calling a "__div__" method; put
a temporary hack there to call "__truediv__" instead when the method
name is "__div__" and 1/2 evaluates to 0.5.

Three standard tests still fail under -Qnew (on Windows; somebody
please try the Linux tests with -Qnew too!  Linux runs a whole bunch
of tests Windows doesn't):
    test_augassign
    test_class
    test_coercion
I can't stay awake longer to stare at this (be my guest).  Offhand
cures weren't obvious, nor was it even obvious that cures are possible
without major hackery.

Question:  when -Qnew is in effect, should calls to __div__ magically
change into calls to __truediv__?  See "major hackery" at tail end of
last paragraph <wink>.
2001-12-06 06:23:26 +00:00
Fred Drake e50959a58e Fix appendChild() and insertBefore() (and replaceChild() indirectly) when
the node being added is a fragment node.
This closes SF bug #487929.
2001-12-06 04:32:18 +00:00
Jack Jansen 8a97f4a380 sys.platform on Mac OS X is now "darwin", without any version number appended.
This should probably go into NEWS (who's responsible for that?).
2001-12-05 23:27:32 +00:00
Guido van Rossum 33bab01da6 Fix SF bug #489581: __slots__ leak.
It was easier than I thought, assuming that no other things contribute
to the instance size besides slots -- a pretty good bet.  With a test
suite, no less!
2001-12-05 22:45:48 +00:00
Fred Drake a16433b14e Re-enabled debugging prints in poplib & documented the set_debuglevel()
method.
This closes SF patch #486079.
2001-12-05 22:37:21 +00:00
Fred Drake ee836445d1 Added a missing period at the end of an error message. 2001-12-05 22:27:47 +00:00
Guido van Rossum d331cb5502 At the PythonLabs meeting someone mentioned it would make Jim really
happy if one could delete the __dict__ attribute of an instance.  I
love to make Jim happy, so here goes...

- New-style objects now support deleting their __dict__.  This is for
  all intents and purposes equivalent to assigning a brand new empty
  dictionary, but saves space if the object is not used further.
2001-12-05 19:46:42 +00:00
Fred Drake 698da02d3b Separate the script portion from the library portion; everything that
pertains to the script is now in the if __name__ == "__main__" block.
This is in response to a commenton python-dev from Neal Norwitz.
2001-12-05 15:58:29 +00:00
Steven M. Gava 2d4e03b092 changes to use new tabpages classes 2001-12-05 07:54:07 +00:00
Steven M. Gava 34b8851c5f remove cruft from other project 2001-12-05 06:39:18 +00:00
Steven M. Gava 5b357b977a cleaner tabbed-page mini implementation through classes 2001-12-05 06:32:46 +00:00
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
Tim Peters 7e0f81e631 Huh. In an effort to be less thorough <wink>, seems I checked in a new
test that wouldn't even compile,
2001-10-31 03:46:14 +00:00
Tim Peters c2fe618575 Fix bad bug in structseq slicing (NULL pointers in result). Reported by
Jack Jansen on python-dev.
Add simple test case.
Move vereq() from test_descr to test_support (it's handy!).
2001-10-30 23:20:46 +00:00
Jeremy Hylton f24339f6f7 /F observes that we need an else: in connect() 2001-10-30 14:16:17 +00:00
Tim Peters 1633a2e345 Whitespace normalization. 2001-10-30 05:56:40 +00:00
Tim Peters 9e6a399b14 To cover a recent checkin, added a test to ensure dir(None) == dir(Ellipsis). 2001-10-30 05:45:26 +00:00
Tim Peters fe677e2012 Just changed some continued-line indentation to read better, due to
the earlier s/dictionary/dict/ change.
2001-10-30 05:41:07 +00:00
Guido van Rossum fa699126b5 Fix SF bug #456386: test_commands regression failure (Andrew Dalke)
test_commands does not work on IRIX

    It assumes the output of "ls /bin/ls" is a line
    that starts with a '-'. On IRIX that file is
    a symbolic link, so the first character is an l.
    This causes test_getstatus to fail.
2001-10-30 03:17:30 +00:00
Guido van Rossum ed87ad876b Minimal test for __del__ hook. 2001-10-30 02:33:02 +00:00
Fredrik Lundh 4ecd71376c directory chooser (requires a recent version of Tk) 2001-10-29 22:58:55 +00:00
Tim Peters a427a2b8d0 Rename "dictionary" (type and constructor) to "dict". 2001-10-29 22:25:45 +00:00
Tim Peters c57a285cb4 SF bug #476138: tempfile behavior across platforms
Ensure that a tempfile can be closed any number of times without error.
This wasn't true on Windows.
2001-10-29 21:46:08 +00:00
Fred Drake 8e26b52a5c Update to reflect changes to the low-level logreader: share the info
dictionary instead of building a new one, and provide an overridable method
to allow subclasses to catch ADD_INFO records that are not part of the
initial block of ADD_INFO records created by the profiler itself.
2001-10-29 20:57:23 +00:00
Fred Drake f3c54d6fc7 Add a test for the insertion of user-provided ADD_INFO records. 2001-10-29 20:54:01 +00:00
Fred Drake 165b2cc2bd Allow user code to call the addinfo() method on the profiler object. 2001-10-29 20:48:09 +00:00
Jeremy Hylton e16e54f7f1 Use connect_ex() instead of connect().
Removes old XXX comment and possible source of long-delays.
2001-10-29 16:44:37 +00:00
Jeremy Hylton fbd5797eb7 Fix for SF bug 453099 -- select not defensive
And SF patch 473223 -- infinite getattr loop

Wrap select() and poll() calls with try/except for EINTR.  If EINTR is
raised, treat as a response where no fd is ready.

In dispatcher constructor, make sure self.socket is always
initialized.
2001-10-29 16:32:19 +00:00
Steven M. Gava 7c01786188 more loading from cfg files 2001-10-29 11:19:46 +00:00
Steven M. Gava 41a8532f66 more of config dialog reading from files 2001-10-29 08:05:34 +00:00
Guido van Rossum 9bd1401bbb Use sendall() in the stream test instead of send(). 2001-10-29 07:18:02 +00:00
Guido van Rossum cb65688218 Test sendall(). 2001-10-29 07:14:10 +00:00
Guido van Rossum b2c763fed2 Add 'sendall' to list of socket methods. 2001-10-29 07:13:53 +00:00
Fredrik Lundh b7747e2a2d added finditer sanity check 2001-10-28 20:15:40 +00:00
Tim Peters 4d85953fe6 dictionary() constructor:
+ Change keyword arg name from "x" to "items".  People passing a mapping
  object can stretch their imaginations <wink>.
+ Simplify the docstring text.
2001-10-27 18:27:48 +00:00
Tim Peters 9fda73cdd1 dict_constructor(): The last test was passing for the wrong reason (it
was intended to verify that sub-sequences of lengths 1 and 3 raise
ValueError, but was actually testing string lengths).
2001-10-26 20:57:38 +00:00
Fred Drake 5445f078df Re-arrange things and remove some unused variables/imports to keep pychecker
happy.  (This does not cover everything it complained about, though.)
2001-10-26 18:02:28 +00:00
Steven M. Gava 2a63a07912 further work supporting reading config dialog values form config files. 2001-10-26 06:50:54 +00:00
Steven M. Gava f126bcb653 dynamic option menu widget. 2001-10-26 06:49:14 +00:00
Steven M. Gava 485f7b6b58 further work on loading config dialog values from the config files 2001-10-26 06:47:09 +00:00
Tim Peters 1fc240e851 Generalize dictionary() to accept a sequence of 2-sequences. At the
outer level, the iterator protocol is used for memory-efficiency (the
outer sequence may be very large if fully materialized); at the inner
level, PySequence_Fast() is used for time-efficiency (these should
always be sequences of length 2).

dictobject.c, new functions PyDict_{Merge,Update}FromSeq2.  These are
wholly analogous to PyDict_{Merge,Update}, but process a sequence-of-2-
sequences argument instead of a mapping object.  For now, I left these
functions file static, so no corresponding doc changes.  It's tempting
to change dict.update() to allow a sequence-of-2-seqs argument too.

Also changed the name of dictionary's keyword argument from "mapping"
to "x".  Got a better name?  "mapping_or_sequence_of_pairs" isn't
attractive, although more so than "mosop" <wink>.

abstract.h, abstract.tex:  Added new PySequence_Fast_GET_SIZE function,
much faster than going thru the all-purpose PySequence_Size.

libfuncs.tex:
- Document dictionary().
- Fiddle tuple() and list() to admit that their argument is optional.
- The long-winded repetitions of "a sequence, a container that supports
  iteration, or an iterator object" is getting to be a PITA.  Many
  months ago I suggested factoring this out into "iterable object",
  where the definition of that could include being explicit about
  generators too (as is, I'm not sure a reader outside of PythonLabs
  could guess that "an iterator object" includes a generator call).
- Please check my curly braces -- I'm going blind <0.9 wink>.

abstract.c, PySequence_Tuple():  When PyObject_GetIter() fails, leave
its error msg alone now (the msg it produces has improved since
PySequence_Tuple was generalized to accept iterable objects, and
PySequence_Tuple was also stomping on the msg in cases it shouldn't
have even before PyObject_GetIter grew a better msg).
2001-10-26 05:06:50 +00:00
Guido van Rossum 6661be3bed Allow assignment to newinstance.__dict__. 2001-10-26 04:26:12 +00:00
Guido van Rossum 0afde13b43 Fix two typos, one noted by Noah Spurrier in SF bug #475166, the
second noted after a second's thought about what the next line should
do. :-(
2001-10-26 03:38:46 +00:00
Barry Warsaw 2539cf5aad A fix for SF bug #472560, extra newlines returned by get_param() when
the separating semi-colon shows up on a continuation line (legal, but
weird).

Bug reported and fixed by Matthew Cowles.  Test case and sample email
included.
2001-10-25 22:43:46 +00:00
Barry Warsaw 107771a228 Applying proposed patch for bug #474583, optional support for
non-standard but common types.  Including Martin's suggestion to add
rejected non-standard types from patch #438790.  Specifically,

guess_type(), guess_extension(): Both the functions and the methods
grow an optional "strict" flag, defaulting to true, which determines
whether to recognize non-standard, but commonly found types or not.

Also, I sorted, reformatted, and culled duplicates from the big
types_map dictionary.  Note that there are a few non-equivalent
duplicates (e.g. .cdf and .xls) for which the first will just get
thrown away.  I didn't remove those though.

Finally, use of the module as a script as grown the -l and -e options
to toggle strictness and to do guess_extension(), respectively.

Doc and unittest updates too.
2001-10-25 21:49:18 +00:00
Fred Drake b112481f12 Ignore the posixfile deprecation warning for the test suite. 2001-10-25 18:11:10 +00:00
Fredrik Lundh 703ce8122c (experimental) "finditer" method/function. this works pretty much
like findall, but returns an iterator (which returns match objects)
instead of a list of strings/tuples.
2001-10-24 22:16:30 +00:00
Fred Drake 9242a4af17 Add a warning to the posixfile module stating that it will go away. 2001-10-24 22:03:35 +00:00
Guido van Rossum e2ae77b8b8 SF patch #474590 -- RISC OS support 2001-10-24 20:42:55 +00:00
Tim Peters c6ac8a78f6 SF bug #473525 pyclbr broken
As the comments in the module implied, pyclbr was easily confused by
"strange stuff" inside single- (but not triple-) quoted strings.  It
isn't anymore.  Its behavior remains flaky in the presence of nested
functions and classes, though.
Bugfix candidate.
2001-10-24 20:22:40 +00:00
Guido van Rossum 83c3281826 Apply the first chunk of the second patch from SF bug #471720:
ThreadingMixIn/TCPServer forgets close (Max Neunhöffer).

This ensures that handle_error() and close_request() are called when
an error occurs in the thread.

(I am not applying the second chunk of the patch, which moved the
finish() call into the finally clause in BaseRequestHandler's __init__
method; that would be a semantic change that I cannot accept at this
point - the data would be sent even if the handler raised an
exception.)
2001-10-23 21:42:45 +00:00
Guido van Rossum f66dacdb01 test_curses is an expected skip on Linux too. 2001-10-23 15:10:55 +00:00
Steven M. Gava 429a86af5b font/tabs config dialog page now reads its data from the config file 2001-10-23 10:42:12 +00:00
Tim Peters c77db34575 SF bug [#473864] doctest expects spurios space.
Repair unlikely surprise due to magical softspace attr and the use of
print with a trailing comma in doctest examples.
Bugfix candidate.
2001-10-23 02:21:52 +00:00
Tim Peters d703057752 Record that test_curses doesn't run on win32. 2001-10-22 22:06:08 +00:00
Fred Drake 4bf018b138 Fixed denial-of-weak-ref-support test; Jeremy changed the error message
used by the weakref code since he didn't like the word "referencable".
Is it really necessary to be more specific than to test for TypeError here,
though?
2001-10-22 21:45:25 +00:00
Jeremy Hylton efef5dae94 A few formatting nits:
Don't put paren in column 0 (to please font-lock mode).
    Put space after comma in argument list.
2001-10-22 18:14:15 +00:00
Andrew M. Kuchling 2158df0b4d Patch #473187: Add a test script that exercises most of the functions in
the curses module.  It's not run automatically; '-u curses' must be
    specified as an argument to regrtest
2001-10-22 15:26:09 +00:00
Fredrik Lundh f864aa8fd9 sre.split should return the last segment, even if empty
(sorry, barry)
2001-10-22 06:01:56 +00:00
Guido van Rossum 56ff387a7e Fix for SF bug #472940: can't getattr() attribute shown by dir()
There really isn't a good reason for instance method objects to have
their own __dict__, __doc__ and __name__ properties that just delegate
the request to the function (callable); the default attribute behavior
already does this.

The test suite had to be fixed because the error changes from
TypeError to AttributeError.
2001-10-22 02:00:09 +00:00
Guido van Rossum c8e5645f15 Methods of built-in types now properly check for keyword arguments
(formerly these were silently ignored).  The only built-in methods
that take keyword arguments are __call__, __init__ and __new__.
2001-10-22 00:43:43 +00:00
Guido van Rossum d6bebce5e5 Make tabnanny happy. (Piers, please run the test suite before
checking in changes.  The test suite requires consistent use of spaces
and tabs.)
2001-10-22 00:42:26 +00:00
Piers Lauder fe6accfc36 update version number 2001-10-21 22:37:28 +00:00
Fredrik Lundh dac58492aa fixed character set description in docstring (SRE uses Python
strings, not C strings)

removed USE_PYTHON defines, and related sre.py helpers

skip calling the subx helper if the template is callable.
interestingly enough, this means that

	def callback(m):
	    return literal
	result = pattern.sub(callback, string)

is much faster than

	result = pattern.sub(literal, string)
2001-10-21 21:48:30 +00:00
Piers Lauder 0402dd18cb fix send method not noticing when partial sends happen 2001-10-21 20:26:37 +00:00
Fredrik Lundh 1296a8d77e sre.Scanner fixes (from Greg Chapman). also added a Scanner sanity
check to the test suite.

added a few missing exception checks in the _sre module
2001-10-21 18:04:11 +00:00
Fredrik Lundh bec95b9d88 rewrote the pattern.sub and pattern.subn methods in C
removed (conceptually flawed) getliteral helper; the new sub/subn code
uses a faster code path for literal replacement strings, but doesn't
(yet) look for literal patterns.

added STATE_OFFSET macro, and use it to convert state.start/ptr to
char indexes
2001-10-21 16:47:57 +00:00
Skip Montanaro 3e7bba9ac6 added tests for long ints and ints where they are > 32 bits.
should have been checked in as part of patch #470254.
2001-10-19 16:06:52 +00:00
Marc-André Lemburg b5507ecd3c Additional test and documentation for the unicode() changes.
This patch should also be applied to the 2.2b1 trunk.
2001-10-19 12:02:29 +00:00
Barry Warsaw 1f0fa92b0a Another merge from mimelib:
TestMIMEMessage.test_epilogue(), TestIdempotent.test_preamble_epilogue():
    Test cases for SF bug #472481.
2001-10-19 04:08:59 +00:00
Barry Warsaw 11ce550578 Another email package test file 2001-10-19 04:07:27 +00:00
Barry Warsaw 856c32b5f4 Another merge from mimelib:
_handle_multipart(): If there is an epilogue and the epilogue does
    not itself start with a newline, add a newline before writing the
    epilogue.  Closes SF bug #472481.
2001-10-19 04:06:39 +00:00
Guido van Rossum c524d952da SF patch #460805 by Chris Gonnerman: Support for unsetenv()
This adds unsetenv to posix, and uses it in the __delitem__ method of
os.environ.

(XXX Should we change the preferred name for putenv to setenv, for
consistency?)
2001-10-19 01:31:59 +00:00
Martin v. Löwis a660a34844 Assume a 64-bit start and len if O_LARGEFILE is available. 2001-10-18 22:07:48 +00:00
Tim Peters e0c446bb4a Whitespace normalization. 2001-10-18 21:57:37 +00:00
Guido van Rossum 1fff878c45 The assignment to result.st_rdev can raise AttributeError as well as
TypeError (on systems where it's not defined at all, it raises
AttributeError; when it's defined, assignment to it raises TypeError).
2001-10-18 21:19:31 +00:00
Fredrik Lundh a5e616510e changed misleading argument name 2001-10-18 20:58:25 +00:00
Guido van Rossum 98bf58f1c6 SF patch #462296: Add attributes to os.stat results; by Nick Mathewson.
This is a big one, touching lots of files.  Some of the platforms
aren't tested yet.  Briefly, this changes the return value of the
os/posix functions stat(), fstat(), statvfs(), fstatvfs(), and the
time functions localtime(), gmtime(), and strptime() from tuples into
pseudo-sequences.  When accessed as a sequence, they behave exactly as
before.  But they also have attributes like st_mtime or tm_year.  The
stat return value, moreover, has a few platform-specific attributes
that are not available through the sequence interface (because
everybody expects the sequence to have a fixed length, these couldn't
be added there).  If your platform's struct stat doesn't define
st_blksize, st_blocks or st_rdev, they won't be accessible from Python
either.

(Still missing is a documentation update.)
2001-10-18 20:34:25 +00:00
Tim Peters 8dd7adeb34 SF bug [#472347] pydoc and properties.
The GUI-mode code to display properties blew up if the property functions
(get, set, etc) weren't simply methods (or functions).

"The problem" here is really that the generic document() method dispatches
to one of .doc{routine, class, module, other}(), but all of those require
a different(!) number of arguments.  Thus document isn't general-purpose
at all:  you have to know exactly what kind of thing is it you're going
to document first, in order to pass the correct number of arguments to
.document for it to pass on.  As an expedient hack, just tacked "*ignored"
on to the end of the formal argument lists for the .docXXX routines so
that .document's caller doesn't have to know in advance which path
.document is going to take.
2001-10-18 19:56:17 +00:00
Fred Drake c10039c011 Do not expect line number events when running under "python -O".
The right fix is to generate line number events anyway ;-), but this will
have to do for now.
2001-10-18 19:34:00 +00:00
Fredrik Lundh 397a654791 SRE bug #441409:
compile should raise error for non-strings
SRE bug #432570, 448951:
    reset group after failed match

also bumped version number to 2.2.0
2001-10-18 19:30:16 +00:00
Fred Drake 3bb4d214a4 Add a test for calling a weakref proxy with a dictionary of keyword args. 2001-10-18 19:28:29 +00:00
Guido van Rossum 4114a4afec Fix the frozen bytecode for __hello__ (betcha didn't know that existed
:-).

Add a test that prevents the __hello__ bytecode from going stale
unnoticed again.

The test also tests the loophole noted in SF bug #404545.  This test
will fail right now; I'll check in the fix in a minute.
2001-10-18 18:49:37 +00:00
Fred Drake 39c27f1ffb Make sure we do not core dump when using proxies with the binary slot
handlers.  This was fixed in Objects/weakrefobject.c 1.2.
2001-10-18 18:06:05 +00:00
Guido van Rossum a5343ccd28 SF bug #471720: ThreadingMixIn/TCPServer forgets close
Solved with a helper method that calls finish_request() and then
close_request().  The code is by Max Neunhöffer.
2001-10-18 18:02:07 +00:00
Martin v. Löwis 29103c7b32 Reindent __repr__. 2001-10-18 17:33:19 +00:00
Jeremy Hylton cf672f15e0 Add test for local assigned to only in a nested list comp 2001-10-18 16:23:11 +00:00
Guido van Rossum f76de62f7d Fix SF bug #472234: type(obj) calls type->tp_init (Roeland Rengelink)
The fix is a band-aid: type_call() now makes the same exception for a
single-argument call to type() as type_new() was already making.
2001-10-18 15:49:21 +00:00
Martin v. Löwis eee80ee2ef Patch #470744: Simplify __repr__ error handling. 2001-10-18 11:39:34 +00:00
Jeremy Hylton 9f6c37df26 Add trivial test cases for RAND_add() and RAND_status().
(The rest of the test cases are trivial, so I don't feel too bad.)
2001-10-18 00:30:14 +00:00
Skip Montanaro 5449e08412 test for int and long int overflow (allows operation on 64-bit platforms)
closes patch 470254
2001-10-17 22:53:33 +00:00
Barry Warsaw 07227d1ec0 Two merges from the mimelib project:
test_no_semis_header_splitter(): This actually should still split.

    test_no_split_long_header(): An example of an unsplittable line.

    test_no_semis_header_splitter(): Test for SF bug # 471918, Generator
    splitting long headers.
2001-10-17 20:52:26 +00:00
Barry Warsaw d1eeecbd43 Two merges from the mimelib project:
_split_header(): Split on folding whitespace if the attempt to split
    on semi-colons failed.

    _split_header(): Patch by Matthew Cowles for fixing SF bug # 471918,
    Generator splitting long headers.
2001-10-17 20:51:42 +00:00
Guido van Rossum 1f74cb3575 Oops. Catching OverflowError from int() doesn't help, since it raises
ValueError on too-large inputs.
2001-10-17 17:21:47 +00:00
Jeremy Hylton 7a1ea0e880 Make sure the output lists are sorted, even if run with -r. 2001-10-17 13:45:28 +00:00
Jeremy Hylton 138d90eb73 Vastly improved stacksize calculation.
There are now no known cases where the compiler package computes a
stack depth lower than the one computed by the builtin compiler.  (To
achieve this state, we had to fix bugs in both compilers :-).

The chief change is to do the depth calculations with respect to basic
blocks.  The stack effect of block is calculated.  Then the flow graph
is traversed using breadth-first search to find the max weight path
through the graph.

Had to fix the StackDepthTracker to calculate the right info for
several opcodes: LOAD_ATTR, CALL_FUNCTION (and friends), MAKE_CLOSURE,
and DUP_TOPX.

XXX Still need to handle free variables in MAKE_CLOSURE.

XXX There are still a lot of places where the computed stack depth is
larger than for the builtin compiler.  These won't cause the
interpreter to overflow the frame, but they waste space.
2001-10-17 13:37:29 +00:00
Jeremy Hylton d114261608 Handle testlist_safe as if it were testlist. 2001-10-17 13:32:52 +00:00
Jeremy Hylton 4bf1fb63e4 track addition of testlist_safe to Grammar 2001-10-17 13:13:04 +00:00
Guido van Rossum bcbdc95e90 SF patch #467430.
- replace some log_error() calls with log_message()

- flush self.rfile before forking too (hope this works on Windows)
2001-10-17 06:45:56 +00:00
Guido van Rossum f93befc209 Folder.getlast(): avoid PyChecker warning. 2001-10-17 05:59:26 +00:00
Fred Drake 2a2d970ef9 Remove unused import; reported by Neal Norwitz. 2001-10-17 01:51:04 +00:00