Commit Graph

96 Commits

Author SHA1 Message Date
Jeremy Hylton 4d508adae3 Fix for SF [ 734869 ] Lambda functions in list comprehensions
The compiler was reseting the list comprehension tmpname counter for each function, but the symtable was using the same counter for the entire module.  Repair by move tmpname into the symtable entry.

Bugfix candidate.
2003-05-21 17:34:50 +00:00
Guido van Rossum 66b1259dbc SF #660455 : patch by NNorwitz.
"Unsigned" (i.e., positive-looking, but really negative) hex/oct
constants with a leading minus sign are once again properly negated.
The micro-optimization for negated numeric constants did the wrong
thing for such hex/oct constants.  The patch avoids the optimization
for all hex/oct constants.

This needs to be backported to Python 2.2!
2003-02-12 16:57:47 +00:00
Guido van Rossum f0253f2bc5 Restore the hex/oct constant tests that Barry commented out for fear
of FutureWarnings.  Added a comment explaining the situation.
2002-08-29 14:57:26 +00:00
Barry Warsaw 18bd11205d Fixed three exceptions in the Plain integers test, although I'm not
sure these are the best fixes.

- Test maxint-1 against the negative octal constant -020000000000

- Comment out the tests for oct -1 and hex -1, since 037777777777 and
  0xffffffff raise FutureWarnings now and in Python 2.4 those
  constants will produce positive values, not negative values.  So the
  existing test seems to test something that won't be true in 2.4.
2002-08-29 13:09:47 +00:00
Barry Warsaw 266e6b1f4b Quite down some FutureWarnings. 2002-08-28 16:36:11 +00:00
Barry Warsaw 408b6d34de Complete the absolute import patch for the test suite. All relative
imports of test modules now import from the test package.  Other
related oddities are also fixed (like DeprecationWarning filters that
weren't specifying the full import part, etc.).  Also did a general
code cleanup to remove all "from test.test_support import *"'s.  Other
from...import *'s weren't changed.
2002-07-30 23:27:12 +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
Jeremy Hylton 7d3dff2b39 SF patch [ #468662 ] Allow jython to complete test_grammar
The behavior of co_varnames in the presence of nested argument tuples
is not consistent across Python and Jython.  Test each platform
separately.
2001-10-10 01:45:02 +00:00
Thomas Wouters 80d373cbd0 Test case for SF bugs #463359 and #462937, added to test_grammar for lack of
a better place. Excessively fragile code, but at least it breaks when
something in this area changes!
2001-09-26 12:43:39 +00:00
Guido van Rossum dbb718fa87 Make these modules work when Python is compiled without Unicode support. 2001-09-21 19:22:34 +00:00
Tim Peters 9f448150c8 Fix another test still expecting overflow on big int literals. 2001-08-27 21:50:42 +00:00
Jeremy Hylton e241e29f3d Add test for a list comprehension that is nested in the left-hand part
of another list comp.  This caused crashes reported as SF bugs 409230
and 407800.

Note that the new tests are in a function so that the name lookup code
isn't affected by how many *other* list comprehensions are in the same
scope.
2001-03-19 20:42:11 +00:00
Jeremy Hylton 2922ea8235 Add test case for global stmt at module level.
Fix test_grammar so that it ignores warning about global stmt at
module level in exec.
2001-02-28 23:49:19 +00:00
Jeremy Hylton f828e2d737 Add simple section for assert, including assert w/ lambdas 2001-02-19 15:54:52 +00:00
Jeremy Hylton 4779399e9f Add test for syntax error on "x = 1 + 1".
Move check_syntax() function into test_support.
2001-02-19 15:35:26 +00:00
Jeremy Hylton 97a01674b2 update test cases for recent compiler changes: exec/import * in nested
functinos and cell vars with */** parameters
2001-02-09 22:56:46 +00:00
Tim Peters 10fb386399 Whitespace normalization. 2001-02-09 20:17:14 +00:00
Jeremy Hylton 3faa52ecc4 Allow 'continue' inside 'try' clause
SF patch 102989 by Thomas Wouters
2001-02-01 22:48:12 +00:00
Jeremy Hylton 483638c9a8 Undo recent change that banned using import to bind a global, as per
discussion on python-dev.  'from mod import *' is still banned except
at the module level.

Fix value for special NOOPT entry in symtable.  Initialze to 0 instead
of None, so that later uses of PyInt_AS_LONG() are valid.  (Bug
reported by Donn Cave.)

replace local REPR macros with PyObject_REPR in object.h
2001-02-01 20:20:45 +00:00
Jeremy Hylton ac25a38841 add test for illegal imports 2001-01-30 01:25:56 +00:00
Jeremy Hylton 619eea6821 PEP 227 implementation
test_new: new.code() noew takes two more arguments
test_grammer: Add a bunch of test cases for lambda (not really PEP 227 related)
2001-01-25 20:12:27 +00:00
Jeremy Hylton 92e9f29aec add extra tests to verify that co_varnames is being set up properly
also normalize checks for syntax errors and delete commented out
definition of verify.
2001-01-25 17:03:37 +00:00
Jeremy Hylton 578ceee042 Add simple test of list comprehension that uses a name that isn't
otherwise used in the same code block.  (Not sure this is the right
place, but there is no test_list_comprehensions.py.)
2001-01-23 01:51:40 +00:00
Jeremy Hylton e1bb5f9814 make error msg more informative when test of exec fails 2001-01-19 03:26:33 +00:00
Marc-André Lemburg 3661908a6a This patch removes all uses of "assert" in the regression test suite
and replaces them with a new API verify(). As a result the regression
suite will also perform its tests in optimization mode.

Written by Marc-Andre Lemburg. Copyright assigned to Guido van Rossum.
2001-01-17 19:11:13 +00:00
Fred Drake 132dce2246 Update the code to better reflect recommended style:
Use != instead of <> since <> is documented as "obsolescent".
Use "is" and "is not" when comparing with None or type objects.
2000-12-12 23:11:42 +00:00
Fred Drake 004d5e6880 Make reindent.py happy (convert everything to 4-space indents!). 2000-10-23 17:22:08 +00:00
Barry Warsaw 7e3e1c1ece Added test cases for extended printing to an instance. This picked up
a bug in JPython where the instance had to have a flush() method.
2000-10-11 21:26:03 +00:00
Marc-André Lemburg d1ba443206 This patch adds a new Python C API called PyString_AsStringAndSize()
which implements the automatic conversion from Unicode to a string
object using the default encoding.

The new API is then put to use to have eval() and exec accept
Unicode objects as code parameter. This closes bugs #110924
and #113890.

As side-effect, the traditional C APIs PyString_Size() and
PyString_AsString() will also accept Unicode objects as
parameters.
2000-09-19 21:04:18 +00:00
Barry Warsaw 9182b45a5a Added tests of "print >> None" 2000-08-29 04:57:10 +00:00
Skip Montanaro 46dfa5f4ed require list comprehensions to start with a for clause 2000-08-22 02:43:07 +00:00
Barry Warsaw efc92eec33 PEP 214, Extended print Statement, has been accepted by the BDFL.
Additional test cases for the extended print form.
2000-08-21 15:46:50 +00:00
Skip Montanaro 803d6e5451 list comprehensions. see
http://sourceforge.net/patch/?func=detailpatch&patch_id=100654&group_id=5470

for details.
2000-08-12 18:09:51 +00:00
Jeremy Hylton aed0d8deb0 add test cases for Greg Ewing's extended call syntax patch 2000-03-28 23:51:17 +00:00
Guido van Rossum 505043f35e No need to define assert, it's built in. 1997-04-16 00:27:45 +00:00
Guido van Rossum 51b1c1c145 avoid math, don't abort when overflow check fails 1995-03-04 22:30:54 +00:00
Guido van Rossum 1f97612e64 Fix exec test so presence of __builtins__ doesn't break it 1995-01-10 10:34:21 +00:00
Guido van Rossum b6775db241 Merge alpha100 branch back to main trunk 1994-08-01 11:34:53 +00:00
Guido van Rossum dd8cb446e1 Some minute changes. 1993-12-29 15:33:08 +00:00
Guido van Rossum b31c7f732a * test_select.py: (some) tests for built-in select module
* test_grammar.py, testall.out: added test for funny things in string literals
* token.py, symbol.py: definitions used with built-in parser module.
* tokenize.py: added double-quote recognition
1993-11-11 10:31:23 +00:00
Guido van Rossum e65cce5eec * string.py: added rindex(), rfind(); changed index() to interpret
negative start indices starting from the right.
* ftplib.py: debug() -> set_debuglevel(); change demo to use __init__().
* os.py: added execl, execlp, and execvp.
* lambda.py: removed (now that we have built-in map, reduce, bagof, lambda)
* test_b{1,2}.py, testall.out: added tests for bagof, lambda, map, reduce
* commands.py: use os, not posix
* test_grammar.py: make it easy to disable non-portable int overflow tests
* dis.py: don't abuse range()
1993-11-08 15:05:21 +00:00
Guido van Rossum b3b09c97ce added builtin b/w compat module.
changed testing of exec.
1993-10-22 14:24:22 +00:00
Guido van Rossum 85f1820ee1 Added some new tests and two new files for testing: test_types.py
(testing operations on built-in types) and autotest.py (automatic
regression testing).
1992-11-27 22:53:50 +00:00
Guido van Rossum 33693ea92a '+' no longer accepted for varargs list 1992-04-03 16:33:00 +00:00
Guido van Rossum 627efd94e9 Some weird forms of try statements are no longer allowed. 1992-03-31 18:54:11 +00:00
Guido van Rossum 3bead0984c Initial revision 1992-01-27 17:00:37 +00:00