Commit Graph

4945 Commits

Author SHA1 Message Date
Tim Peters 9f448150c8 Fix another test still expecting overflow on big int literals. 2001-08-27 21:50:42 +00:00
Tim Peters c15a82813a Change test_overflow to test_no_overflow; looks like big int literals
are auto-coerced to longs now, but this test still expected OverflowError.
I can't imagine this test failure was unique to Windows.
2001-08-27 21:45:32 +00:00
Jeremy Hylton cd8a127e1a Fix for sibling nodes that define the same free variable
Evan Simpson's fix.  And his explanation:

    If you defined two nested functions in a row that refer to the
    same non-global variable, the second one will be generated as
    though the variable were global.
2001-08-27 21:06:35 +00:00
Jeremy Hylton 7e30c9bb5a Add lookup_name() to optimize use of stack frames
The use of com_node() introduces a lot of extra stack frames, enough
to cause a stack overflow compiling test.test_parser with the standard
interpreter recursionlimit.  The com_node() is a convenience function
that hides the dispatch details, but comes at a very high cost.  It is
more efficient to dispatch directly in the callers.  In these cases,
use lookup_node() and call the dispatched node directly.

Also handle yield_stmt in a way that will work with Python 2.1
(suggested by Shane Hathaway)
2001-08-27 21:02:51 +00:00
Jeremy Hylton 058a5adad0 Two changes to visitor API:
Remove _preorder as alias for dispatch and call dispatch directly.
    Add an extra optional argument to walk()

XXX Also comment out some code that does debugging prints.
2001-08-27 20:47:08 +00:00
Jeremy Hylton 6d8c1aabff Add content-type header to ftp URLs (SF patch #454553)
Modify rfc822.formatdate() to always generate English names,
regardless of locale.  This is required by RFC 1123.

In open_local_file() of urllib and urllib2, use new formatdate() from
rfc822.
2001-08-27 20:16:53 +00:00
Tim Peters 9aa70d93aa SF bug [#455775] float parsing discrepancy.
PyTokenizer_Get:  error if exponent contains no digits (3e, 2.0e+, ...).
2001-08-27 19:19:28 +00:00
Jack Jansen e259e5980c Patch by Bill Noon: added 'dylib' as a library type along with
'static' and 'shared'. This fixes extension building for dynamic
Pythons on MacOSX.
2001-08-27 15:08:16 +00:00
Guido van Rossum ea46fa8494 Undo previous checkin -- Barry fixed it better. 2001-08-24 19:46:21 +00:00
Guido van Rossum d320ad08bf Update test output to match new (more informative) error message about
calling unbound method with wrong first argument.
2001-08-24 19:31:43 +00:00
Barry Warsaw 191487351a Quick and dirty fix for test_extcall failures trigged by Guido's
recent classobject.c change.  When calling an unbound method with no
instances as first argument, the error message has changed.  The
message now contains the class name, but the output text being
compared to is too generic, so skip printing it.
2001-08-24 19:11:57 +00:00
Guido van Rossum 70d4491540 Remove the local 'getset' class -- this is now a built-in type with
the same signature.
2001-08-24 18:52:50 +00:00
Barry Warsaw 1e2775f370 Rip the import repr truncation test out of here and put it in test_repr.py 2001-08-24 18:38:02 +00:00
Barry Warsaw 0bcf6d8d54 Added lots of tests for reprs of "simple" objects, such as file,
lambda (anonymous functions?), function, xrange, buffer, cell (need to
fill in), and (some) descriptor types.

Also added a new test case for testing repr truncation fixes.
2001-08-24 18:37:32 +00:00
Tim Peters 16c018d2d2 Repair repr of future-features (wasn't updated to include the new
compiler-flag argument).
2001-08-24 17:13:54 +00:00
Guido van Rossum 9881fc124e supers(): typo -- "if verify" should be "if verbose". 2001-08-24 17:07:20 +00:00
Guido van Rossum c4a1880de4 Add test suite for super(). 2001-08-24 16:55:27 +00:00
Guido van Rossum 76f0cb85c2 Add a test for the new getset type. 2001-08-24 15:24:24 +00:00
Guido van Rossum 833a8d8641 SF patch #454553 by Walter Dörwald: add content-type to FTP URLs, like
for urllib.
2001-08-24 13:10:13 +00:00
Tim Peters 89675078cb Back out trying to use the C values for CO_xxx.
__future__.py reverted to 1.9.
newmodule.c reverted to 2.32.
2001-08-24 06:29:12 +00:00
Tim Peters 4e2fbce71c Looks like someone forgot the change the expected output file. 2001-08-24 04:33:10 +00:00
Tim Peters a365309528 Add a test for the new // operator too. 2001-08-23 23:02:57 +00:00
Tim Peters 26c7fa355a SF bug [#454456] int overflow code needs tests.
Added tests for boundary cases in magical PEP 237 int->long auto-overflow,
but nothing here addresses the rest of the bug report so left it open.
2001-08-23 22:56:21 +00:00
Greg Ward f17efb93d9 Patch #449054 to implement PEP 250. The standard install directory for
modules and extensions on Windows is now $PREFIX/Lib/site-packages.
Includes backwards compatibility code for pre-2.2 Pythons.  Contributed
by Paul Moore.
2001-08-23 20:53:27 +00:00
Tim Peters 971e0690c4 Remove test_long's expected-output file. 2001-08-23 20:34:01 +00:00
Fredrik Lundh c266bb0594 untabification 2001-08-23 20:13:08 +00:00
Fredrik Lundh 78eedce3ff updated to current PythonWare version (1.0b3). fixed type checks in
DateTime constructor.  use ServerProxy instead of Server in sample
code.
2001-08-23 20:04:33 +00:00
Finn Bock 84cc9bf722 Committing and closing SF patch #441348 to help Jython to pass this test. 2001-08-23 18:57:01 +00:00
Guido van Rossum 88e0b5bee0 SF patch #454553 by Walter Dörwald: auto-guess content-type header for
ftp urls.
2001-08-23 13:38:15 +00:00
Jack Jansen be92af0e2a Don't make even the _slightest_ modification between test and checkin,
or you will break something:-)
2001-08-23 13:25:59 +00:00
Jack Jansen 0eb936b47d The MacOS module may be available on Mac OS X, but it doesn't have a SchedParams() method, and there's no need to call it anyway. 2001-08-23 13:18:10 +00:00
Guido van Rossum 83b120d690 Turn OverflowWarning into an error locally, in order to make the
OverflowError test succeed.
2001-08-23 03:23:03 +00:00
Guido van Rossum acc21d8814 Ignore OverflowWarning by default. To enable the warning, use
python -Wdefault

or

	python -Wdefault::OverflowWarning
2001-08-23 03:07:42 +00:00
Barry Warsaw 60f018846d Merge changes from r22a2-branch back into trunk. Also, change patch
level to 2.2a2+
2001-08-22 19:24:42 +00:00
Ka-Ping Yee 83205972a2 Enhancements:
- file URL now starts with "file://" (standard) rather than "file:"
- new optional argument 'context' to enable()
- repeated variable names don't have their values shown twice
- dotted attributes are shown; missing attributes handled reasonably
- highlight the whole logical line even if it has multiple physical lines
- use nice generator interface to tokenize
- formatting fixed so that it looks good in lynx, links, and w3m too
2001-08-21 06:53:01 +00:00
Barry Warsaw d1ed15edb3 A test of SSL support, using a roundabout method suggested by Guido.
However, this is only enabled with regrtest's --use=network switch.
2001-08-20 22:39:42 +00:00
Barry Warsaw 7fdfc3885c Use test_support.requires() to decide whether additional largefile
tests should be run.
2001-08-20 22:37:34 +00:00
Barry Warsaw 08fca52125 Removed --have-resources flag in favor of the more granular -u/--use
flag, which specifies external or resource intensive tests to
perform.  This is used by test_largefile and test_socket_ssl.

-u/--use takes a comma separated list of flags, currently supported:
largefile, network.

usage(): New function.  Note that the semantics of main() have changed
    slightly; instead of returning an error code, it raises a
    SystemExit (via sys.exit()) with the given error code.

main(): use_large_resources => use_resources
    Also, added support for long-option alternative to the short
    options.

_expectations: Added test_socket_ssl to the list of expectedly skipped
    tests.
2001-08-20 22:33:46 +00:00
Barry Warsaw c0fb605ce3 use_large_resources => use_resources
requires(): New function which can be used to `assert' that a specific
    -u/--use resource flag is present.  Raises a TestSkipped if not.
    This is used in test_largefile and test_socket_ssl to enable
    external or resource consumptive tests that are normally
    disabled.
2001-08-20 22:29:23 +00:00
Tim Peters 7c005af915 Whitespace normalization. 2001-08-20 21:48:00 +00:00
Tim Peters 02035bc68d Test failed because these was no expected-output file, but always printed
to stdout.  Repaired by not printing at all except in verbose mode.

Made the test about 6x faster -- envelope analysis showed it took time
proportional to the square of the # of tasks.  Now it's linear.
2001-08-20 21:45:19 +00:00
Fred Drake 029acfb922 Deal more appropriately with bare ampersands and pointy brackets; this
module has to deal with "class" HTML-as-deployed as well as XHTML, so we
cannot be as strict as XHTML allows.

This closes SF bug #453059, but uses a different fix than suggested in
the bug comments.
2001-08-20 21:24:19 +00:00
Jeremy Hylton 18da1e1e7f Add test case to cover multiple future statements on separate lines of
a module.
2001-08-20 21:18:56 +00:00
Jeremy Hylton 8471a35feb Fix SF bug [ #450245 ] Error in parsing future stmts
Add test case to cover multiple future statements on separate lines of
a module.
2001-08-20 20:33:42 +00:00
Barry Warsaw 07d8d6415f Committing and closing SF patch #403671 by Finn Bock to help Jython
pass these tests.
2001-08-20 20:29:07 +00:00
Skip Montanaro 4533f60da5 add a few test cases for threading module. 2001-08-20 20:28:48 +00:00
Skip Montanaro e428bb7030 Added new BoundedSemaphore class. Closes bug 452836. 2001-08-20 20:27:58 +00:00
Jeremy Hylton a7fc21baf6 Silence warnings during test_os 2001-08-20 20:10:01 +00:00
Eric S. Raymond 29bb115bae Clean up some argument profiles, enrich the docstring. 2001-08-20 13:16:30 +00:00
Skip Montanaro ae8454aeb3 of course I muffed it separating the notes code from the initial_value
code.  grrr...
2001-08-19 05:53:47 +00:00
Guido van Rossum 8cb00e2387 Avoid total dependency on the new module. This addresses the problem
reported by Greg Ball on python-dev.
2001-08-19 05:29:25 +00:00
Skip Montanaro b446fc7f27 add debug calls to self._note for the Semaphore class. This closes bug
443614.  I will submit a new feature request and patch to threading.py and
libthreading.tex to address the bounded semaphore issue.
2001-08-19 04:25:24 +00:00
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