Commit Graph

16247 Commits

Author SHA1 Message Date
Tim Peters 2cfa9806c7 Run tests twice by default, first time deleting .pyc/.pyo files.
New option "-q" to leave .pyc/.pyo alone.
2001-01-19 21:43:49 +00:00
Marc-André Lemburg 6f77667a64 Backed out the unistr() builtin. 2001-01-19 21:36:19 +00:00
Guido van Rossum a8e14d4d03 Use a saner test filename, to work on Windows. 2001-01-19 21:06:50 +00:00
Guido van Rossum 4bf9c20e18 Delete the bytecode from the library and tests before running the
tests for the first time -- like the Unix Makefile does.  This
avoids not catching problems in the bytecode generator and/or bytecode
marshalling.
2001-01-19 21:00:04 +00:00
Guido van Rossum 75e0058cde "make test" was still broken when building in a subdirectory: Andrew's
fix set PYTHONPATH to something starting with $(srcdir)/build/lib....
The use of $(srcdir) was wrong here, it should be ./build/lib...
2001-01-19 20:21:59 +00:00
Moshe Zadka ccc2e3d05d OK, checking in patch 103329.
Please check it against your nearest pop server --
mine doesn't support APOP (I checked I'm getting the same error
message, though)
2001-01-19 19:56:27 +00:00
Barry Warsaw 2e9b396740 Add some regression tests of coredump bugs in funcobject.c 2.31. Also
added a test of a coredump that would occur when del'ing
func_defaults (put here for convenience).
2001-01-19 19:55:12 +00:00
Barry Warsaw 0395fdd3a9 Application and elaboration of patch #103305 to fix core dumps when
del'ing func.func_dict.  I took the opportunity to also clean up some
other nits with the code, namely core dumps when del'ing func_defaults
and KeyError instead of AttributeError when del'ing a non-existant
function attribute.

Specifically,

func_memberlist: Move func_dict and __dict__ into here instead of
special casing them in the setattro and getattro methods.  I don't
remember why I took them out of here before I first uploaded the PEP
232 patch. :/

func_getattro(): No need to special case __dict__/func_dict since
their now in the func_memberlist and PyMember_Get() should Do The
Right Thing (i.e. transforms NULL values into Py_None).

func_setattro(): Document the intended behavior of del'ing or setting
to None one of the special func_* attributes.  I.e.:

    func_code - can only be set to a code object.  It can't be del'd
    or set to None.

    func_defaults - can be del'd.  Can only be set to None or a tuple.

    func_dict - can be del'd.  Can only be set to None or a
    dictionary.

Fix core dumps and incorrect exceptions as described above.  Also, if
we're del'ing an arbitrary function attribute but func_dict is NULL,
don't create func_dict before discovering that we'll get an
AttributeError anyway.
2001-01-19 19:53:29 +00:00
Fredrik Lundh 7c1e4bbe25 gethash/cmpname both looked beyond the end of the character name.
This patch makes u"\N{x}" a bit less dependent on pure luck...
2001-01-19 19:45:02 +00:00
Tim Peters 5458fcf9c5 Repair "selective cut-&-paste" screwup. 2001-01-19 19:17:46 +00:00
Guido van Rossum a1374e429b Change verify() function to raise TestFailed, not AssertionError.
(I realize that I didn't really test this, because all the tests
succeed, so verify() never raised an AssertionError -- but the test
suite still succeeds, so I'm not too worried.)
2001-01-19 19:01:56 +00:00
Andrew M. Kuchling e7c87327b3 GvR pointed out the correct way to check for statically built modules;
sys.builtin_module_names
Add SSL directories in /usr/contrib/ for FreeBSD
2001-01-19 16:58:21 +00:00
Guido van Rossum 10b04180a0 Bump __version__; add authorship note for the BaseServer patch. 2001-01-19 16:45:46 +00:00
Andrew M. Kuchling f5c9e86333 Add Jason Tishler to the ACKS file 2001-01-19 16:29:28 +00:00
Andrew M. Kuchling 989835c9fc Patch #103220 from Jason Tishler:
This patch adds support for Cygwin to util.get_platform(). A Cygwin
  specific case is needed due to the format of Cygwin's uname command,
  which contains '/' characters.
2001-01-19 16:26:12 +00:00
Andrew M. Kuchling ae89af9c63 Minor patch from Thomas Gellekum:
* Deletes the Panel_NoArgReturnStringFunction() macro, which isn't used
     anymore
   * Adjusts two comments.
2001-01-19 15:35:26 +00:00
Fredrik Lundh 95f1e6f631 new unicode name database (~160k) 2001-01-19 11:52:33 +00:00
Fredrik Lundh 2acb54a194 improved the ucnhash test a bit 2001-01-19 11:13:46 +00:00
Fredrik Lundh ee865c64da added "getcode" and "getname" methods to the ucnhash module (they're
probably more useful for the test code than for any applications, but
one never knows...)
2001-01-19 11:00:42 +00:00
Tim Peters d5d2cd149f Color all word instances of "as" after "import", & on the same line, as if
keywords.  Cheap approximation to the truth.
2001-01-19 10:41:49 +00:00
Fredrik Lundh 0fdb90cafe refactored the unicodeobject/ucnhash interface, to hide the
implementation details inside the ucnhash module.

also cleaned up the unicode copyright blurb a little; Secret Labs'
internal revision history isn't that interesting...
2001-01-19 09:45:02 +00:00
Tim Peters a2bf2709b3 Update the example DLL instructions for 2.1. Add example.def to the
MSVC project file (as the instructions always recommended doing).
2001-01-19 08:45:48 +00:00
Tim Peters cc58363611 urllib.py very recently changed to produce uppercase escapes, but no
corresponding changes were made to its std test.
2001-01-19 07:00:08 +00:00
Tim Peters 8880f6d3c4 Whitespace normalization. 2001-01-19 06:12:17 +00:00
Tim Peters 1a8a53d16f test_urllib is failing on Windows. I don't know why, but I can at least
change the test to give a clue about *where* it's failing.
2001-01-19 06:06:37 +00:00
Tim Peters 983874dd32 Use constructor form of "raise"; normalize <wink> docstrings. 2001-01-19 05:59:21 +00:00
Tim Peters d93c0b6a37 Jeremy's patch #103323: trivial tests of all untested modules. 2001-01-19 05:41:36 +00:00
Guido van Rossum 9d593a526b This still mentioned IdlePrefs.py as the place to edit color
preferences.  It is now in config.txt or ~/.idle.
2001-01-19 03:30:58 +00:00
Jeremy Hylton 1a34c879bc make the output of _test() suitable for use in the regression test 2001-01-19 03:30:22 +00:00
Guido van Rossum e27a7b8074 Anonymous SF bug 129288: "The python 2.0 urllib has %%%x as a format
when quoting forbidden characters. There are scripts out there that
break with lower case, therefore I guess %%%X should be used."

I agree, so am fixing this.
2001-01-19 03:28:15 +00:00
Jeremy Hylton e1bb5f9814 make error msg more informative when test of exec fails 2001-01-19 03:26:33 +00:00
Jeremy Hylton 047e2c93e2 add test for SyntaxError on
def f(a):
        global a
2001-01-19 03:25:56 +00:00
Jeremy Hylton c862cf400f clearer error messages for apply() and "no locals" 2001-01-19 03:25:05 +00:00
Jeremy Hylton b4ed8c4db0 add test of bastion and rexec to std regression test suite 2001-01-19 03:22:48 +00:00
Jeremy Hylton e36f77814e This patch introduces an extra pass to the compiler that generates a
symbol table for each top-level compilation unit.  The information in
the symbol table allows the elimination of the later optimize() pass;
the bytecode generation emits the correct opcodes.

The current version passes the complete regression test, but may still
contain some bugs.  It's a fairly substantial revision.  The current
code adds an assert() and a test that may lead to a Py_FatalError().
I expect to remove these before 2.1 beta 1.

The symbol table (struct symtable) is described in comments in the
code.

The changes affects the several com_XXX() functions that were used to
emit LOAD_NAME and its ilk.  The primary interface for this bytecode
is now com_addop_varname() which takes a kind and a name, where kind
is one of VAR_LOAD, VAR_STORE, or VAR_DELETE.

There are many other smaller changes:

- The name mangling code is no longer contained in ifdefs.  There are
  two functions that expose the mangling logical: com_mangle() and
  symtable_mangle().

- The com_error() function can accept NULL for its first argument;
  this is useful with is_constant_false() is called during symbol
  table generation.

- The loop index names used by list comprehensions have been changed
  from __1__ to [1], so that they can not be accessed by Python code.

- in com_funcdef(), com_argdefs() is now called before the body of the
  function is compiled.  This provides consistency with com_lambdef()
  and symtable_funcdef().

- Helpers do_pad(), dump(), and DUMP() are added to aid in debugging
  the compiler.
2001-01-19 03:21:30 +00:00
Tim Peters 19fe14e76a Derivative of patch #102549, "simpler, faster(!) implementation of string.join".
Also fixes two long-standing bugs (present in 2.0):
1. .join() didn't check that the result size fit in an int.
2. string.join(s) when len(s)==1 returned s[0] regardless of s[0]'s
   type; e.g., "".join([3]) returned 3 (overly optimistic optimization).
I resisted a keen temptation to make .join() apply str() automagically.
2001-01-19 03:03:47 +00:00
Andrew M. Kuchling e3d6e41d81 Revert a single line of my large change earlier today; this broke the ability
to build in a subdirectory.  The additional directory is unfortunately
    redundant when *not* building in a subdirectory, which is why I took
    it out.
2001-01-19 02:50:34 +00:00
Guido van Rossum fc53c13dd5 Checking in a slight variation of Barry's patch 103303. 2001-01-19 02:41:41 +00:00
Guido van Rossum 8dabbf149e Fix for the bug in complex() just reported by Ping. 2001-01-19 02:11:59 +00:00
Guido van Rossum 90cb9067b8 SF Patch #102980, by Luke Kenneth Casson Leighton: BaseServer class
for SocketServer.py (inherited by TCPServer)

Luke wrote:

  The socketserver code, with a little bit of tweaking, can be made
  sufficiently general to service "requests" of any kind, not just by sockets.
  The BaseServer class was created, for example, to poll a table in a MYSQL
  database every 2 seconds. each entry in the table can be allocated a
  Handler which deals with the entry.

  With this patch, using BaseServer and ThreadedServer classes, the creation
  of the server that reads and handles MySQL table entries instead of a
  socket was utterly trivial: about 50 lines of python code.

  You may consider this code to be utterly useless [why would anyone else
  want to do anything like this???] - you are entitled to your opinion. if you
  think so, then think of this: have you considered how to cleanly add SSL to
  the TCPSocketServer? What about using shared memory as the
  communications mechanism for a server, instead of sockets? What about
  communication using files?

  The SocketServer code is extremely good every useful. it's just that as it
  stands, it is tied to sockets, which is not as useful.

I heartily approve of this idea.
2001-01-19 00:44:41 +00:00
Guido van Rossum 3fa560b343 SF Patch #103188, by Donn Cave: BeOS/ar-fake support for extra
libraries.

(I have no way to test this, I just trust Donn.)
2001-01-19 00:31:10 +00:00
Guido van Rossum 7150a77863 SF Patch #103185, by jlt63: Some more standard modules cleanup for Cygwin
Support building this as a DLL under Cygwin.
2001-01-19 00:29:06 +00:00
Guido van Rossum 6915c4d0a8 Support building this as a DLL under Cygwin. 2001-01-19 00:28:08 +00:00
Guido van Rossum fc5ce61abd SF Patch #103250, by pj99: Optimize a strspn() out of startup.
Minor startup speedup: avoid a call to strspn().
2001-01-19 00:24:06 +00:00
Guido van Rossum 2312024eb7 Add test that ensures hash() of objects defining __cmp__ or __eq__ but
not __hash__ raises TypeError.
2001-01-18 23:47:15 +00:00
Guido van Rossum 65e8bd7fd5 Rich comparisons fallout: instance_hash() should check for both
__cmp__ and __eq__ absent before deciding to do a quickie
based on the object address.  (Tim Peters discovered this.)
2001-01-18 23:46:31 +00:00
Guido van Rossum 0c6614c789 Add test that ensures hash([]) and hash({}) raise TypeError. 2001-01-18 23:36:14 +00:00
Guido van Rossum 41c3244875 Rich comparisons fallout: PyObject_Hash() should check for both
tp_compare and tp_richcompare NULL before deciding to do a quickie
based on the object address.  (Tim Peters discovered this.)
2001-01-18 23:33:37 +00:00
Guido van Rossum a3af41d564 Changes to recursive-object comparisons, having to do with a test case
I found where rich comparison of unequal recursive objects gave
unintuituve results.  In a discussion with Tim, where we discovered
that our intuition on when a<=b should be true was failing, we decided
to outlaw ordering comparisons on recursive objects.  (Once we have
fixed our intuition and designed a matching algorithm that's practical
and reasonable to implement, we can allow such orderings again.)

- Refactored the recursive-object comparison framework; more is now
  done in the support routines so less needs to be done in the calling
  routines (even at the expense of slowing it down a bit -- this
  should normally never be invoked, it's mostly just there to avoid
  blowing up the interpreter).

- Changed the framework so that the comparison operator used is also
  stored.  (The dictionary now stores triples (v, w, op) instead of
  pairs (v, w).)

- Changed the nesting limit to a more reasonable small 20; this only
  slows down comparisons of very deeply nested objects (unlikely to
  occur in practice), while speeding up comparisons of recursive
  objects (previously, this would first waste time and space on 500
  nested comparisons before it would start detecting recursion).

- Changed rich comparisons for recursive objects to raise a ValueError
  exception when recursion is detected for ordering oprators (<, <=,
  >, >=).

Unrelated change:

- Moved PyObject_Unicode() to just under PyObject_Str(), where it
  belongs.  MAL's patch must've inserted in a random spot between two
  functions in the file -- between two helpers for rich comparison...
2001-01-18 22:07:06 +00:00
Guido van Rossum 4e8db2ed9d Since I'm about to check in a change to the recursion-detection code
for comparisons that outlaws requets for ordering on recursive data
structures, remove the tests for ordering recursive data structures.
2001-01-18 21:52:26 +00:00