Commit Graph

4893 Commits

Author SHA1 Message Date
Guido van Rossum 112ea6bfa6 Inspired by Greg Stein's proposed simplification of the _closesocket
class, I came up with an even simpler solution: raise the error in
__getattr__().
2001-08-18 21:00:39 +00:00
Tim Peters aa32070f4d Expose the CO_xxx flags via the "new" module (re-solving a problem "the
right way").  Fiddle __future__.py to use them.

Jeremy's pyassem.py may also want to use them (by-hand duplication of
magic numbers is brittle), but leaving that to his judgment.

Beef up __future__'s test to verify the exported feature names appear
correct.
2001-08-18 20:18:49 +00:00
Eric S. Raymond b60f2d0977 Framework code for compilerlike scripts. 2001-08-18 09:24:38 +00:00
Greg Stein 81937a4a12 Resolve patch #449367.
For the HTTPS class (when available), ensure that the x509 certificate data
gets passed through to the HTTPSConnection class. Create a new
HTTPS.__init__ to do this, and refactor the HTTP.__init__ into a new _setup
method for both init's to call.

Note: this is solved differently from the patch, which advocated a new
**x509 parameter on the base HTTPConnection class. But that would open
HTTPConnection to arbitrary (ignored) parameters, so was not as desirable.
2001-08-18 09:20:23 +00:00
Ka-Ping Yee 6cb0d4c632 Add some fairly important file extensions: bmp css doc mid midi mp2 mp3 xls.
Entries taken from the standard Debian mime.types file.
2001-08-18 04:06:54 +00:00
Ka-Ping Yee 6b5a48d48e Initial check-in of cgitb.
A few enhancements are pending, but this should work reliably.
2001-08-18 04:04:50 +00:00
Guido van Rossum e5e50591a4 When the socket is closed, don't just assign 0 to self._sock.
This breaks software that excepts a socket.error but not an
AttributeError.
2001-08-18 01:23:20 +00:00
Jeremy Hylton ab427b8cce Generate correct reprs for Mul, Add, etc. 2001-08-18 00:14:37 +00:00
Jeremy Hylton ec5bfd13ca Track removal of doc string from Module().nodes[0] 2001-08-18 00:07:46 +00:00
Jeremy Hylton 8548f9b183 Add Yield() node 2001-08-18 00:07:14 +00:00
Tim Peters 4fd9e2fc13 Remove the horrid generators hack from doctest.py. This relies on a
somewhat less horrid hack <wink>:  if a module does
    from __future__ import X
then the module dict D is left in a state such that (viewing X as a
string)
    D[X] is getattr(__future__, X)
So by examining D for all the names of future features, and making that
test for each, we can make a darned good guess as to which future-features
were imported by the module.  The appropriate flags are then sucked out
of the __future__ module, and passed on to compile()'s new optional
arguments (PEP 264).

Also gave doctest a meaningful __all__, removed the history of changes
(CVS serves that purpose now), and removed the __version__ vrbl (similarly;
before CVS, it was a reasonable clue, but not anymore).
2001-08-18 00:05:50 +00:00
Jeremy Hylton ec927348c2 Add Yield() statement handler
Fix Module() handler to avoid including the doc string in the AST
2001-08-18 00:04:31 +00:00
Tim Peters 9fa96bed6f Fix for bug [#452230] future division isn't propagated.
builtin_eval wasn't merging in the compiler flags from the current frame;
I suppose we never noticed this before because future division is the
first future-feature that can affect expressions (nested_scopes and
generators had only statement-level effects).
2001-08-17 23:04:59 +00:00
Tim Peters 6cd6a82db9 A fiddled version of the rest of Michael Hudson's SF patch
#449043 supporting __future__ in simulated shells
which implements PEP 264.
2001-08-17 22:11:27 +00:00
Martin v. Löwis 10d7255249 Use raw-unicode-escape for the tests that require it. 2001-08-17 22:08:34 +00:00
Guido van Rossum 65d5d7fac6 Add test for weak references. 2001-08-17 21:27:53 +00:00
Barry Warsaw d1795705de Test that uu.py will not override an existing file if out_file isn't
given and the path is gleaned from the uu header.
2001-08-17 20:00:11 +00:00
Barry Warsaw 59dae8ad36 decode(): Raise a uu.Error if no out_file is given but the file
specified in the uu header already exists.  No additional
    workaround is provided since out_file=pathname is a deprecated
    interface, so it is better to simply pass a file-like object into
    out_file anyway.  This closes SF bug #438083.

Use isinstance() tests instead of type comparisons.
2001-08-17 19:59:34 +00:00
Tim Peters de642bdc5d A self-contained piece of Michael Hudson's patch
#449043 supporting __future__ in simulated shells
in support of PEP 264.

Much has changed from the patch version:
+ Repaired bad hex constant for nested_scopes.
+ Defined symbolic CO_xxx names so global search will find these uses.
+ Made the exported list of feature names explicit, instead of abusing
  __all__ for this purpose (and redefined __all__ accordingly).
+ Added gross .compiler_flag verification to test___future__.py, and
  reworked it a little to make use of the newly exported explicit list
  of feature names.
2001-08-17 19:49:02 +00:00
Guido van Rossum b0a98e9c94 Address SF #451547. The approach is a bit draconian: any object that
is pickled as a global must now exist by the name under which it is
pickled, otherwise the pickling fails.  Previously, such things would
fail on unpickling, or unpickle as the wrong global object.  I'm
hoping that this won't break existing code that is playing tricks with
this.

I need a volunteer to do this for cPickle too.
2001-08-17 18:49:52 +00:00
Martin v. Löwis 339d0f720e Patch #445762: Support --disable-unicode
- Do not compile unicodeobject, unicodectype, and unicodedata if Unicode is disabled
- check for Py_USING_UNICODE in all places that use Unicode functions
- disables unicode literals, and the builtin functions
- add the types.StringTypes list
- remove Unicode literals from most tests.
2001-08-17 18:39:25 +00:00
Guido van Rossum 70297d3bd4 Change the 227 response parser to use a more liberal regular
expression.  This is needed for certain servers that (in violation of
the standard) don't return the parentheses in the response.

This fixes SF bug #441712 by Henrik Weber (not exactly using his
patch).
2001-08-17 17:24:29 +00:00
Guido van Rossum 84a79a8d25 classic(),metods(): add tests to verify that a bound method without a
class has a correct repr().
2001-08-17 13:58:31 +00:00
Guido van Rossum 93018760bc classic(), methods(): add another test relating to unbound methods:
when an unbound method of class A is stored as a class variable of
class B, and class B is *not* a subclass of class A, that method
should *not* get bound to B instances.
2001-08-17 13:40:47 +00:00
Guido van Rossum 7e1ff69271 Add early binding of methods to the 2nd metaclass example. 2001-08-17 11:55:58 +00:00
Guido van Rossum 309b566704 metaclass(): add tests for metaclasses written in Python: one that
subclasses type, one that doesn't (the latter isn't fully functional
yet).
2001-08-17 11:43:17 +00:00
Barry Warsaw f6365e0107 Added a test for module repr truncation when the package name is
really long.  Closes SF bug #437984.
2001-08-16 20:42:38 +00:00
Guido van Rossum 501c7c7d0e classobject.c:instancemethod_descr_get(): when a bound method is
assigned to a class variable and then accessed via an instance, it
should not be rebound.

test_descr.py:methods(): test for the condition above.
2001-08-16 20:41:56 +00:00
Andrew M. Kuchling db7aed5219 [Patch #441691] preprocess() method for Borland C compiler.
I have no way of testing this.
2001-08-16 20:17:41 +00:00
Tim Peters 4d2dded044 test_descr started breaking in yet another way in the same place. 2001-08-16 19:50:51 +00:00
Fred Drake 3791838339 New unit test for the mimetypes module, to avoid future regressions. 2001-08-16 18:36:59 +00:00
Fred Drake c81a06998f Another egregious error that copied the encodings info over the suffix
info.  Caught by the tests that I'm writing now.
2001-08-16 18:14:38 +00:00
Martin v. Löwis c47016ee74 Use (c)StringIO for collecting bytes. Fixes bug #451622. 2001-08-16 17:06:44 +00:00
Tim Peters 63a8d69476 Repair some accidents causing Windows failures:
+ test_compare.  While None compares less than anything else, it's not
  always the case that None has the smallest id().
+ test_descr.  The output of %p (pointer) formats varies across platforms.
  In particular, on Windows it doesn't produce a leading "0x".
2001-08-16 16:56:16 +00:00
Fred Drake c019ecb7fe Bad bug: the MimeTypes.readfp() was supposed to take a file object as a
parameter, but did not.  This was found because it can create failures
elsewhere based on the presence of mime.types files in some common locations
the module searches by default.

(I will be writing a test for this module shortly!)
2001-08-16 15:54:28 +00:00
Andrew M. Kuchling b1d6029437 [Patch #444854 from twburton]
Add executable extension, needed to get the program name right on Win32
2001-08-16 14:08:02 +00:00
Andrew M. Kuchling 6fb8d3a3d6 [Patch #442530 from twburton]
Provide include_dirs argument to all calls to ._preprocess and ._compile
    Fix typo: pattern.search(pattern) should be pattern.search(line)
2001-08-16 13:56:40 +00:00
Guido van Rossum 297abadc6b The change of type(None).__name__ from 'None' to 'NoneType' broke this
test in a trivial way.  Fixed.
2001-08-16 08:32:39 +00:00
Guido van Rossum a4ff6ab093 Add tests for overridable operators that have default interpretations
(__hash__ etc.), in static and dynamic classes, overridden and
default.
2001-08-15 23:57:59 +00:00
Just van Rossum ba634b2ec3 Rewrote Jack's latest change so it does what it intended to do... 2001-08-15 21:20:42 +00:00
Guido van Rossum 28962cc0ea Given a class without __cmp__ or __eq__, cmp() of two instances of
that class should compare the id() of those instances.  Add a test
that verifies this.  This test currently fails; I believe this is
caused by object.c:2.132 (Patch #424475 by loewis).
2001-08-15 21:02:20 +00:00
Guido van Rossum b5a136b05d Add a test to verify that bound methods work correctly. 2001-08-15 17:51:17 +00:00
Jack Jansen 31b5323c84 Don't remove non-directories from sys.path on the mac: files
can be on sys.path too.
2001-08-15 12:07:46 +00:00
Tim Peters e5614630fb Move one of the tests into the "PEP 255" section, to reflect a change in
the PEP.
2001-08-15 04:41:19 +00:00
Jeremy Hylton 9272b14d62 Fix typo in astgen script 2001-08-14 21:18:30 +00:00
Guido van Rossum 80e36750c8 Add a test for a weird bug I just discovered: a dynamic subclass
doesn't have a __dict__!
2001-08-14 20:00:33 +00:00
Jeremy Hylton 7713ac2ff1 Regenerated from new ast.txt and new astgen.py 2001-08-14 18:59:01 +00:00
Barry Warsaw 033daa49ea Test the new semantics for setting and deleting a function's __dict__
attribute.  Deleting it, or setting it to a non-dictionary result in a
TypeError.  Note that getting it the first time magically initializes
it to an empty dict so that func.__dict__ will always appear to be a
dictionary (never None).

Closes SF bug #446645.
2001-08-14 18:28:28 +00:00
Barry Warsaw b9c1d3dedf reload(exceptions) should not raise an ImportError, but should act
just like reload(sys).  Test that this is so.  Closes SF bug #422004.
2001-08-13 23:07:00 +00:00
Tim Peters 04601063e8 Repair Unix-specific assumptions that caused this to fail on Windows. 2001-08-13 22:25:24 +00:00
Barry Warsaw 406d46e185 found_terminator(): Add a debug print showing the data. 2001-08-13 21:18:01 +00:00
Fred Drake 3a28ca8fb8 Nick Mathewson: test suite for the class browser support module. 2001-08-13 20:26:19 +00:00
Fred Drake 03f7a70345 Nick Mathewson: Make sure the recursion is handled properly.
This is part of SF patch #440292.
2001-08-13 20:20:51 +00:00
Guido van Rossum 97dbec97bc Remove redundant import (PyChecker).
Update greeting message to avoid the long copyright notice.
2001-08-13 15:58:26 +00:00
Guido van Rossum 4a5555b19d Remove unused variable 'imports' from readmodule_ex(). 2001-08-13 15:55:19 +00:00
Guido van Rossum 8f15bd8500 Remove redundant 'import string' (PyChecker). 2001-08-13 15:48:06 +00:00
Guido van Rossum ef8f4dee07 Remove redundant imports (PyChecker). 2001-08-13 15:37:02 +00:00
Guido van Rossum a79bbaca54 Remove redundant 'import sys' (PyChecker). 2001-08-13 15:34:41 +00:00
Guido van Rossum f9f48812d0 Remove two redundant statements (PyChecker). 2001-08-13 15:30:22 +00:00
Guido van Rossum bfbc18dbf9 Remove redundant assignment l = [] from poll3() -- copy-and-paste
error.
2001-08-13 15:21:55 +00:00
Guido van Rossum 8710681400 Commenting out the getfillable() method -- it's broken, and nobody
remembers what it is supposed to do. :-(
2001-08-13 15:04:33 +00:00
Andrew M. Kuchling 7c2cf73811 Remove redefinition of has_option() method 2001-08-13 14:58:32 +00:00
Andrew M. Kuchling 8ea9227b1b Remove empty __init__ (PyChecker) 2001-08-13 14:55:17 +00:00
Andrew M. Kuchling f31d31373e Remove redefinition of writelines() method
Remove unused variable and import
2001-08-13 14:54:12 +00:00
Andrew M. Kuchling 77f9caf633 Remove unused variable (PyChecker) 2001-08-13 14:52:37 +00:00
Andrew M. Kuchling 1f877ef199 Remove some dead code (PyChecker) 2001-08-13 14:50:44 +00:00
Andrew M. Kuchling 86c7e22036 Add forgotten import (PyChecker) 2001-08-13 14:47:12 +00:00
Andrew M. Kuchling e7abf97903 Remove unused import (PyChecker) 2001-08-13 14:43:43 +00:00
Andrew M. Kuchling 6be424fdd6 Remove redundant import 2001-08-13 14:41:39 +00:00
Andrew M. Kuchling 994b51e906 Capture exception message (PyChecker) 2001-08-13 14:40:47 +00:00
Andrew M. Kuchling a49e0a0893 Remove unused imports (PyChecker) 2001-08-13 14:40:29 +00:00
Andrew M. Kuchling 3e44248483 Remove unused variable 2001-08-13 14:38:50 +00:00
Andrew M. Kuchling 118aa5337c Fix malformed line (PyChecker) 2001-08-13 14:37:23 +00:00
Guido van Rossum 49fa2bdaa1 Fix two bugs discovered by PyChecker. (I cannot test these, but I'm
confident that the old code was utterly broken -- the worse that can
happen is that the new code is still broken.)
2001-08-13 14:12:35 +00:00
Andrew M. Kuchling 246c425964 Fix for NameError caught by PyChecker.
(This command seems to be essentially untested; should fix that...)
2001-08-13 13:56:24 +00:00
Andrew M. Kuchling fd6608bcea Fix typo (PyChecker) 2001-08-13 13:48:55 +00:00
Andrew M. Kuchling fee3126eb3 Catch curses.error instead of a non-existent global (PyChecker)
Edit comment
2001-08-13 13:47:23 +00:00
Andrew M. Kuchling 40ea6177b9 Remove redundant import 2001-08-13 13:45:22 +00:00
Steven M. Gava 33277c767f further work on font config and general feel improvements 2001-08-13 04:36:58 +00:00
Tim Peters 5e824c37d3 SF patch #445412 extract ndiff functionality to difflib, from
David Goodger.
2001-08-12 22:25:01 +00:00
Jeremy Hylton 39f77bc90e Modify _Set to support iteration.
Otherwise printlist(surprise) will fail with a TypeError, because map
is called with an argument that doesn't support iteration.
2001-08-12 21:53:08 +00:00
Guido van Rossum d3077402c7 - Expand test for dynamic objects.
- Remove various 'global' directives and move some global definitions
  inside the test functions that use them -- we have nested scopes so
  the old hacks using globals are no longer needed.
2001-08-12 05:24:18 +00:00
Tim Peters a45da92484 Make the output of tests skipped readable (i.e., deliberately break it
into indented lines each of which probably fits on a typical screen line).
2001-08-12 03:45:50 +00:00
Guido van Rossum 9d4fe4298e dynamics(): add tests for dynamic *instances* (which are currently
broken).  Also fix an invalid reference to C (should be S).
2001-08-12 03:38:18 +00:00
Jeremy Hylton 08a6403973 Test the unary operator changes to the compiler 2001-08-12 02:22:27 +00:00
Guido van Rossum f73e30c3e3 Add the list of expected skips for Linux 2.x. Restructured the code a
little bit using a dictionary to avoid more code duplication as
more platforms are supported.
2001-08-12 02:22:19 +00:00
Tim Peters a2be2d624a Move line; reported on python-dev by Mark Favas (thanks!). 2001-08-12 02:01:09 +00:00
Tim Peters b5b7b78414 Teach regrtest which tests we *expect* to skip on Win32. Please teach it
about your platform too.
2001-08-12 01:20:39 +00:00
Steven M. Gava 28ccc2463e removed some cruft 2001-08-12 01:14:55 +00:00
Tim Peters a6a4f27ef7 _Condition.wait(): never sleep longer than the timeout time remaining,
and even if we have a long time left to wait, try the lock at least 20
times/second.
2001-08-12 00:41:33 +00:00
Jack Jansen dbc363ce35 The test assumed that the local pathname convention for "foo" would sort before "foo/bar", which is not true on the mac (where they are "foo" and ":foo:bar", respectively; ":foo" would be fine too, but "foo" is the preferred spelling). Fixed by sorting the output. 2001-08-11 23:22:43 +00:00
Jeremy Hylton d5d8fc559c Replace all type comparisons with isinstance() calls 2001-08-11 21:44:46 +00:00
Steven M. Gava c01e30f072 repair posix fonts fix 2001-08-11 15:48:13 +00:00
Martin v. Löwis 58682b7fe5 Only catch the errors that can actually occur, as reported in bug #411881. 2001-08-11 15:02:57 +00:00
Steven M. Gava abdfc4147d support for help menu changes 2001-08-11 07:46:26 +00:00
Steven M. Gava 5b3ac8f98f some re-design 2001-08-11 07:45:28 +00:00
Steven M. Gava 6b1ab255c2 supports about changes 2001-08-11 07:44:28 +00:00
Steven M. Gava 0ba4df89ab adjust help menu bindings 2001-08-11 07:42:37 +00:00
Fred Drake cd112f5546 Added tests for rich comparison operator functions.
Converted tests to PyUnit.
2001-08-11 03:21:35 +00:00
Guido van Rossum e45763a8e6 Add test for SF bug #442833 (multiple inheritance). 2001-08-10 21:28:46 +00:00