Commit Graph

47 Commits

Author SHA1 Message Date
Dong-hee Na d905df766c
bpo-39573: Add Py_IS_TYPE() function (GH-18488)
Co-Author: Neil Schemenauer <nas-github@arctrix.com>
2020-02-13 18:37:17 +01:00
Nick Coghlan 5dbe0f59b7
bpo-37757: Disallow PEP 572 cases that expose implementation details (GH-15131)
- drop TargetScopeError in favour of raising SyntaxError directly
  as per the updated PEP 572
- comprehension iteration variables are explicitly local, but
  named expression targets in comprehensions are nonlocal or
  global. Raise SyntaxError as specified in PEP 572
- named expression targets in the outermost iterable of a
  comprehension have an ambiguous target scope. Avoid resolving
  that question now by raising SyntaxError. PEP 572
  originally required this only for cases where the bound name
  conflicts with the iteration variable in the comprehension,
  but CPython can't easily restrict the exception to that case
  (as it doesn't know the target variable names when visiting
  the outermost iterator expression)
2019-08-25 23:45:40 +10:00
Emily Morehouse 8f59ee01be
bpo-35224: PEP 572 Implementation (#10497)
* Add tokenization of :=
- Add token to Include/token.h. Add token to documentation in Doc/library/token.rst.
- Run `./python Lib/token.py` to regenerate Lib/token.py.
- Update Parser/tokenizer.c: add case to handle `:=`.

* Add initial usage of := in grammar.

* Update Python.asdl to match the grammar updates. Regenerated Include/Python-ast.h and Python/Python-ast.c

* Update AST and compiler files in Python/ast.c and Python/compile.c. Basic functionality, this isn't scoped properly

* Regenerate Lib/symbol.py using `./python Lib/symbol.py`

* Tests - Fix failing tests in test_parser.py due to changes in token numbers for internal representation

* Tests - Add simple test for := token

* Tests - Add simple tests for named expressions using expr and suite

* Tests - Update number of levels for nested expressions to prevent stack overflow

* Update symbol table to handle NamedExpr

* Update Grammar to allow assignment expressions in if statements.
Regenerate Python/graminit.c accordingly using `make regen-grammar`

* Tests - Add additional tests for named expressions in RoundtripLegalSyntaxTestCase, based on examples and information directly from PEP 572

Note: failing tests are currently commented out (4 out of 24 tests currently fail)

* Tests - Add temporary syntax test failure tests in test_parser.py

Note: There is an outstanding TODO for this -- syntax tests need to be
moved to a different file (presumably test_syntax.py), but this is
covering what needs to be tested at the moment, and it's more convenient
to run a single test for the time being

* Add support for allowing assignment expressions as function argument annotations. Uncomment tests for these cases because they all pass now!

* Tests - Move existing syntax tests out of test_parser.py and into test_named_expressions.py. Refactor syntax tests to use unittest

* Add TargetScopeError exception to extend SyntaxError

Note: This simply creates the TargetScopeError exception, it is not yet
used anywhere

* Tests - Update tests per PEP 572

Continue refactoring test suite:
The named expression test suite now checks for any invalid cases that
throw exceptions (no longer limited to SyntaxErrors), assignment tests
to ensure that variables are properly assigned, and scope tests to
ensure that variable availability and values are correct

Note:
- There are still tests that are marked to skip, as they are not yet
implemented
- There are approximately 300 lines of the PEP that have not yet been
addressed, though these may be deferred

* Documentation - Small updates to XXX/todo comments

- Remove XXX from child description in ast.c
- Add comment with number of previously supported nested expressions for
3.7.X in test_parser.py

* Fix assert in seq_for_testlist()

* Cleanup - Denote "Not implemented -- No keyword args" on failing test case. Fix PEP8 error for blank lines at beginning of test classes in test_parser.py

* Tests - Wrap all file opens in `with...as` to ensure files are closed

* WIP: handle f(a := 1)

* Tests and Cleanup - No longer skips keyword arg test. Keyword arg test now uses a simpler test case and does not rely on an external file. Remove print statements from ast.c

* Tests - Refactor last remaining test case that relied on on external file to use a simpler test case without the dependency

* Tests - Add better description of remaning skipped tests. Add test checking scope when using assignment expression in a function argument

* Tests - Add test for nested comprehension, testing value and scope. Fix variable name in skipped comprehension scope test

* Handle restriction of LHS for named expressions - can only assign to LHS of type NAME. Specifically, restrict assignment to tuples

This adds an alternative set_context specifically for named expressions,
set_namedexpr_context. Thus, context is now set differently for standard
assignment versus assignment for named expressions in order to handle
restrictions.

* Tests - Update negative test case for assigning to lambda to match new error message. Add negative test case for assigning to tuple

* Tests - Reorder test cases to group invalid syntax cases and named assignment target errors

* Tests - Update test case for named expression in function argument - check that result and variable are set correctly

* Todo - Add todo for TargetScopeError based on Guido's comment (2b3acd37bd (r30472562))

* Tests - Add named expression tests for assignment operator in function arguments

Note: One of two tests are skipped, as function arguments are currently treating
an assignment expression inside of parenthesis as one child, which does
not properly catch the named expression, nor does it count arguments
properly

* Add NamedStore to expr_context. Regenerate related code with `make regen-ast`

* Add usage of NamedStore to ast_for_named_expr in ast.c. Update occurances of checking for Store to also handle NamedStore where appropriate

* Add ste_comprehension to _symtable_entry to track if the namespace is a comprehension. Initialize ste_comprehension to 0. Set set_comprehension to 1 in symtable_handle_comprehension

* s/symtable_add_def/symtable_add_def_helper. Add symtable_add_def to handle grabbing st->st_cur and passing it to symtable_add_def_helper. This now allows us to call the original code from symtable_add_def by instead calling symtable_add_def_helper with a different ste.

* Refactor symtable_record_directive to take lineno and col_offset as arguments instead of stmt_ty. This allows symtable_record_directive to be used for stmt_ty and expr_ty

* Handle elevating scope for named expressions in comprehensions.

* Handle error for usage of named expression inside a class block

* Tests - No longer skip scope tests. Add additional scope tests

* Cleanup - Update error message for named expression within a comprehension within a class. Update comments. Add assert for symtable_extend_namedexpr_scope to validate that we always find at least a ModuleScope if we don't find a Class or FunctionScope

* Cleanup - Add missing case for NamedStore in expr_context_name. Remove unused var in set_namedexpr_content

* Refactor - Consolidate set_context and set_namedexpr_context to reduce duplicated code. Special cases for named expressions are handled by checking if ctx is NamedStore

* Cleanup - Add additional use cases for ast_for_namedexpr in usage comment. Fix multiple blank lines in test_named_expressions

* Tests - Remove unnecessary test case. Renumber test case function names

* Remove TargetScopeError for now. Will add back if needed

* Cleanup - Small comment nit for consistency

* Handle positional argument check with named expression

* Add TargetScopeError exception definition. Add documentation for TargetScopeError in c-api docs. Throw TargetScopeError instead of SyntaxError when using a named expression in a comprehension within a class scope

* Increase stack size for parser by 200. This is a minimal change (approx. 5kb) and should not have an impact on any systems. Update parser test to allow 99 nested levels again

* Add TargetScopeError to exception_hierarchy.txt for test_baseexception.py_

* Tests - Major update for named expression tests, both in test_named_expressions and test_parser

- Add test for TargetScopeError
- Add tests for named expressions in comprehension scope and edge cases
- Add tests for named expressions in function arguments (declarations
and call sites)
- Reorganize tests to group them more logically

* Cleanup - Remove unnecessary comment

* Cleanup - Comment nitpicks

* Explicitly disallow assignment expressions to a name inside parentheses, e.g.: ((x) := 0)

- Add check for LHS types to detect a parenthesis then a name (see note)
- Add test for this scenario
- Update tests for changed error message for named assignment to a tuple
(also, see note)

Note: This caused issues with the previous error handling for named assignment
to a LHS that contained an expression, such as a tuple. Thus, the check
for the LHS of a named expression must be changed to be more specific if
we wish to maintain the previous error messages

* Cleanup - Wrap lines more strictly in test file

* Revert "Explicitly disallow assignment expressions to a name inside parentheses, e.g.: ((x) := 0)"

This reverts commit f1531400ca7d7a2d148830c8ac703f041740896d.

* Add NEWS.d entry

* Tests - Fix error in test_pickle.test_exceptions by adding TargetScopeError to list of exceptions

* Tests - Update error message tests to reflect improved messaging convention (s/can't/cannot)

* Remove cases that cannot be reached in compile.c. Small linting update.

* Update Grammar/Tokens to add COLONEQUAL. Regenerate all files

* Update TargetScopeError PRE_INIT and POST_INIT, as this was purposefully left out when fixing rebase conflicts

* Add NamedStore back and regenerate files

* Pass along line number and end col info for named expression

* Simplify News entry

* Fix compiler warning and explicity mark fallthrough
2019-01-24 16:49:56 -07:00
Victor Stinner 5f2df88b63
bpo-35177: Add dependencies between header files (GH-10361)
* ast.h now includes Python-ast.h and node.h
* parsetok.h now includes node.h and grammar.h
* symtable.h now includes Python-ast.h
* Modify asdl_c.py to enhance Python-ast.h:

  * Add #ifndef/#define Py_PYTHON_AST_H to be able to include the header
    twice
  * Add "extern { ... }" for C++
  * Undefine "Yield" macro conflicting with winbase.h

* Remove "#undef Yield" from C files, it's now done in Python-ast.h
* Remove now useless includes in C files
2018-11-12 00:56:19 +01:00
Nitish Chandra 3a087beddd bpo-32836: Remove obsolete code from symtable pass (GH-5680)
When comprehensions switched to using a nested scope, the old
code for generating a temporary name to hold the accumulation
target became redundant, but was never actually removed.

Patch by Nitish Chandra.
2018-02-27 07:31:20 +10:00
Yury Selivanov eb6364557f Issue #28003: Implement PEP 525 -- Asynchronous Generators. 2016-09-08 22:01:51 -07:00
Yury Selivanov f8cb8a16a3 Issue #27985: Implement PEP 526 -- Syntax for Variable Annotations.
Patch by Ivan Levkivskyi.
2016-09-08 20:50:03 -07:00
Benjamin Peterson 1dfd247c1b remove the concept of an unoptimized function scope from the compiler, since it can't happen anymore 2015-04-27 21:44:22 -04:00
Victor Stinner 14e461d5b9 Close #11619: The parser and the import machinery do not encode Unicode
filenames anymore on Windows.
2013-08-26 22:28:21 +02:00
Benjamin Peterson 312595ce3a hide the __class__ closure from the class body (#12370) 2013-05-15 15:26:42 -05:00
Nick Coghlan e69bfc3fb6 Issue #5765: Merge from 3.3 2012-11-04 23:53:15 +10:00
Nick Coghlan aab9c2b2ea Issue #5765: Apply a hard recursion limit in the compiler
Previously, excessive nesting in expressions would blow the
stack and segfault the interpreter. Now, a hard limit based
on the configured recursion limit and a hardcoded scaling
factor is applied.
2012-11-04 23:14:34 +10:00
Benjamin Peterson d9c8702c0f point errors related to nonlocals and globals to the statement declaring them (closes #10189) 2012-10-31 20:26:20 -04:00
Eli Bendersky dd97fbb2dc Issue #9904: fix and clarify some comments + fix indentation in symtable code 2011-04-10 07:37:26 +03:00
Victor Stinner 00676d1436 Issue #9738: Document encodings of AST, compiler, parser and PyRun functions 2010-12-27 01:49:31 +00:00
Martin v. Löwis 4d0d471a80 Merge branches/pep-0384. 2010-12-03 20:14:31 +00:00
Benjamin Peterson d4efd9eb15 add column offset to all syntax errors 2010-09-20 23:02:10 +00:00
Benjamin Peterson 20f9c3c50f revert unintended changes 2010-07-20 22:39:34 +00:00
Benjamin Peterson 013783c529 move test_trace.py so as not to conflict with future tests for the trace module 2010-07-20 22:37:19 +00:00
Antoine Pitrou f95a1b3c53 Recorded merge of revisions 81029 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r81029 | antoine.pitrou | 2010-05-09 16:46:46 +0200 (dim., 09 mai 2010) | 3 lines

  Untabify C files. Will watch buildbots.
........
2010-05-09 15:52:27 +00:00
Benjamin Peterson 78565b2216 Merged revisions 73376,73393,73398,73400,73404-73405,73409,73419-73421,73432,73457,73460,73485-73486,73488-73489,73501-73502,73513-73514 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r73376 | benjamin.peterson | 2009-06-11 17:29:23 -0500 (Thu, 11 Jun 2009) | 1 line

  remove check for case handled in sub-function
........
  r73393 | alexandre.vassalotti | 2009-06-12 13:56:57 -0500 (Fri, 12 Jun 2009) | 2 lines

  Clear reference to the static PyExc_RecursionErrorInst in _PyExc_Fini.
........
  r73398 | alexandre.vassalotti | 2009-06-12 15:57:12 -0500 (Fri, 12 Jun 2009) | 3 lines

  Add const qualifier to PyErr_SetFromErrnoWithFilename and to
  PyErr_SetFromErrnoWithUnicodeFilename.
........
  r73400 | alexandre.vassalotti | 2009-06-12 16:43:47 -0500 (Fri, 12 Jun 2009) | 2 lines

  Delete outdated make file for building the parser with MSVC 6.
........
  r73404 | benjamin.peterson | 2009-06-12 20:40:00 -0500 (Fri, 12 Jun 2009) | 1 line

  keep the slice.step field as NULL if no step expression is given
........
  r73405 | benjamin.peterson | 2009-06-12 22:46:30 -0500 (Fri, 12 Jun 2009) | 1 line

  prevent import statements from assigning to None
........
  r73409 | benjamin.peterson | 2009-06-13 08:06:21 -0500 (Sat, 13 Jun 2009) | 1 line

  allow importing from a module named None if it has an 'as' clause
........
  r73419 | benjamin.peterson | 2009-06-13 11:19:19 -0500 (Sat, 13 Jun 2009) | 1 line

  set Print.values to NULL if there are no values
........
  r73420 | benjamin.peterson | 2009-06-13 12:08:53 -0500 (Sat, 13 Jun 2009) | 1 line

  give a better error message when deleting ()
........
  r73421 | benjamin.peterson | 2009-06-13 15:23:33 -0500 (Sat, 13 Jun 2009) | 1 line

  when no module is given in a 'from' relative import, make ImportFrom.module NULL
........
  r73432 | amaury.forgeotdarc | 2009-06-14 16:20:40 -0500 (Sun, 14 Jun 2009) | 3 lines

  #6227: Because of a wrong indentation, the test was not testing what it should.
  Ensure that the snippet in doctest_aliases actually contains aliases.
........
  r73457 | benjamin.peterson | 2009-06-16 18:13:09 -0500 (Tue, 16 Jun 2009) | 1 line

  add underscores
........
  r73460 | benjamin.peterson | 2009-06-16 22:23:04 -0500 (Tue, 16 Jun 2009) | 1 line

  remove unused 'encoding' member from the compiler struct
........
  r73485 | benjamin.peterson | 2009-06-19 17:07:47 -0500 (Fri, 19 Jun 2009) | 1 line

  remove duplicate test
........
  r73486 | benjamin.peterson | 2009-06-19 17:09:17 -0500 (Fri, 19 Jun 2009) | 1 line

  add missing assertion #6313
........
  r73488 | benjamin.peterson | 2009-06-19 17:16:28 -0500 (Fri, 19 Jun 2009) | 1 line

  show that this one isn't used
........
  r73489 | benjamin.peterson | 2009-06-19 17:21:12 -0500 (Fri, 19 Jun 2009) | 1 line

  use closures
........
  r73501 | benjamin.peterson | 2009-06-21 18:01:07 -0500 (Sun, 21 Jun 2009) | 1 line

  don't need to add the name 'lambda' as assigned
........
  r73502 | benjamin.peterson | 2009-06-21 18:03:36 -0500 (Sun, 21 Jun 2009) | 1 line

  remove tmpname support since it's no longer used
........
  r73513 | benjamin.peterson | 2009-06-22 20:18:57 -0500 (Mon, 22 Jun 2009) | 1 line

  fix grammar
........
  r73514 | benjamin.peterson | 2009-06-22 22:01:56 -0500 (Mon, 22 Jun 2009) | 1 line

  remove some unused symtable constants
........
2009-06-28 19:19:51 +00:00
Benjamin Peterson 55e00f279f Merged revisions 65715,65724,65726,65732,65736-65739,65775 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r65715 | benjamin.peterson | 2008-08-16 16:04:16 -0500 (Sat, 16 Aug 2008) | 1 line

  add some documentation for symtable
........
  r65724 | benjamin.peterson | 2008-08-16 17:11:33 -0500 (Sat, 16 Aug 2008) | 2 lines

  include filename and line number in SyntaxError
........
  r65726 | georg.brandl | 2008-08-16 17:37:05 -0500 (Sat, 16 Aug 2008) | 2 lines

  Review symtable docs.
........
  r65732 | benjamin.peterson | 2008-08-16 18:29:40 -0500 (Sat, 16 Aug 2008) | 1 line

  PySTEntry's constructor is static; there's no point in a fancy API name
........
  r65736 | benjamin.peterson | 2008-08-16 20:09:17 -0500 (Sat, 16 Aug 2008) | 1 line

  expose PySTEntry.nested so the symtable module will work
........
  r65737 | benjamin.peterson | 2008-08-16 20:17:15 -0500 (Sat, 16 Aug 2008) | 1 line

  a few improvements
........
  r65738 | benjamin.peterson | 2008-08-16 20:27:30 -0500 (Sat, 16 Aug 2008) | 1 line

  fix compile errors
........
  r65739 | benjamin.peterson | 2008-08-16 21:23:43 -0500 (Sat, 16 Aug 2008) | 1 line

  uhh PySTEntry->ste_unoptimized has to be exposed too
........
  r65775 | benjamin.peterson | 2008-08-17 12:13:26 -0500 (Sun, 17 Aug 2008) | 5 lines

  get the symtable module back in working order
  - Fix broken functions
  - Add (hopefully) extensive tests
  - Modernize a little
........
2008-08-17 18:02:44 +00:00
Christian Heimes 90aa7646af #1629: Renamed Py_Size, Py_Type and Py_Refcnt to Py_SIZE, Py_TYPE and Py_REFCNT. 2007-12-19 02:45:37 +00:00
Martin v. Löwis 9f2e346911 Merged revisions 56467-56482 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/p3yk

................
  r56477 | martin.v.loewis | 2007-07-21 09:04:38 +0200 (Sa, 21 Jul 2007) | 11 lines

  Merged revisions 56466-56476 via svnmerge from
  svn+ssh://pythondev@svn.python.org/python/trunk

  ........
    r56476 | martin.v.loewis | 2007-07-21 08:55:02 +0200 (Sa, 21 Jul 2007) | 4 lines

    PEP 3123: Provide forward compatibility with Python 3.0, while keeping
    backwards compatibility. Add Py_Refcnt, Py_Type, Py_Size, and
    PyVarObject_HEAD_INIT.
  ........
................
  r56478 | martin.v.loewis | 2007-07-21 09:47:23 +0200 (Sa, 21 Jul 2007) | 2 lines

  PEP 3123: Use proper C inheritance for PyObject.
................
  r56479 | martin.v.loewis | 2007-07-21 10:06:55 +0200 (Sa, 21 Jul 2007) | 3 lines

  Add longintrepr.h to Python.h, so that the compiler can
  see that PyFalse is really some kind of PyObject*.
................
  r56480 | martin.v.loewis | 2007-07-21 10:47:18 +0200 (Sa, 21 Jul 2007) | 2 lines

  Qualify SHIFT, MASK, BASE.
................
  r56482 | martin.v.loewis | 2007-07-21 19:10:57 +0200 (Sa, 21 Jul 2007) | 2 lines

  Correctly refer to _ob_next.
................
2007-07-21 17:22:18 +00:00
Nick Coghlan 650f0d06d3 Hide list comp variables and support set comprehensions 2007-04-15 12:05:43 +00:00
Jeremy Hylton 81e9502df6 Provisional implementation of PEP 3104.
Add nonlocal_stmt to Grammar and Nonlocal node to AST.  They both
parallel the definitions for globals.  The symbol table treats
variables declared as nonlocal just like variables that are free
implicitly.

This change is missing the language spec changes, but makes some
decisions about what the spec should say via the unittests.  The PEP
is silent on a number of decisions, so we should review those before
claiming that nonlocal is complete.

Thomas Wouters made the grammer and ast changes.  Jeremy Hylton added
the symbol table changes and the tests.  Pete Shinners and Neal
Norwitz helped review the code.
2007-02-27 06:50:52 +00:00
Georg Brandl 7cae87ca7b Patch #1550800: make exec a function. 2006-09-06 06:51:57 +00:00
Thomas Wouters 73e5a5b65d Merge the rest of the trunk.
Merged revisions 46490-46494,46496,46498,46500,46506,46521,46538,46558,46563-46567,46570-46571,46583,46593,46595-46598,46604,46606,46609-46753 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r46610 | martin.v.loewis | 2006-06-03 09:42:26 +0200 (Sat, 03 Jun 2006) | 2 lines

  Updated version (win32-icons2.zip) from #1490384.
........
  r46612 | andrew.kuchling | 2006-06-03 20:09:41 +0200 (Sat, 03 Jun 2006) | 1 line

  [Bug #1472084] Fix description of do_tag
........
  r46614 | andrew.kuchling | 2006-06-03 20:33:35 +0200 (Sat, 03 Jun 2006) | 1 line

  [Bug #1475554] Strengthen text to say 'must' instead of 'should'
........
  r46616 | andrew.kuchling | 2006-06-03 20:41:28 +0200 (Sat, 03 Jun 2006) | 1 line

  [Bug #1441864] Clarify description of 'data' argument
........
  r46617 | andrew.kuchling | 2006-06-03 20:43:24 +0200 (Sat, 03 Jun 2006) | 1 line

  Minor rewording
........
  r46619 | andrew.kuchling | 2006-06-03 21:02:35 +0200 (Sat, 03 Jun 2006) | 9 lines

  [Bug #1497414] _self is a reserved word in the WATCOM 10.6 C compiler.
  Fix by renaming the variable.

  In a different module, Neal fixed it by renaming _self to self.  There's
  already a variable named 'self' here, so I used selfptr.

  (I'm committing this on a Mac without Tk, but it's a simple search-and-replace.
  <crosses fingers>, so  I'll watch the buildbots and see what happens.)
........
  r46621 | fredrik.lundh | 2006-06-03 23:56:05 +0200 (Sat, 03 Jun 2006) | 5 lines

  "_self" is a said to be a reserved word in Watcom C 10.6.  I'm
  not sure that's really standard compliant behaviour, but I guess
  we have to fix that anyway...
........
  r46622 | andrew.kuchling | 2006-06-04 00:44:42 +0200 (Sun, 04 Jun 2006) | 1 line

  Update readme
........
  r46623 | andrew.kuchling | 2006-06-04 00:59:23 +0200 (Sun, 04 Jun 2006) | 1 line

  Drop 0 parameter
........
  r46624 | andrew.kuchling | 2006-06-04 00:59:59 +0200 (Sun, 04 Jun 2006) | 1 line

  Some code tidying; use curses.wrapper
........
  r46625 | andrew.kuchling | 2006-06-04 01:02:15 +0200 (Sun, 04 Jun 2006) | 1 line

  Use True; value returned from main is unused
........
  r46626 | andrew.kuchling | 2006-06-04 01:07:21 +0200 (Sun, 04 Jun 2006) | 1 line

  Use true division, and the True value
........
  r46627 | andrew.kuchling | 2006-06-04 01:09:58 +0200 (Sun, 04 Jun 2006) | 1 line

  Docstring fix; use True
........
  r46628 | andrew.kuchling | 2006-06-04 01:15:56 +0200 (Sun, 04 Jun 2006) | 1 line

  Put code in a main() function; loosen up the spacing to match current code style
........
  r46629 | andrew.kuchling | 2006-06-04 01:39:07 +0200 (Sun, 04 Jun 2006) | 1 line

  Use functions; modernize code
........
  r46630 | andrew.kuchling | 2006-06-04 01:43:22 +0200 (Sun, 04 Jun 2006) | 1 line

  This demo requires Medusa (not just asyncore); remove it
........
  r46631 | andrew.kuchling | 2006-06-04 01:46:36 +0200 (Sun, 04 Jun 2006) | 2 lines

  Remove xmlrpc demo -- it duplicates the SimpleXMLRPCServer module.
........
  r46632 | andrew.kuchling | 2006-06-04 01:47:22 +0200 (Sun, 04 Jun 2006) | 1 line

  Remove xmlrpc/ directory
........
  r46633 | andrew.kuchling | 2006-06-04 01:51:21 +0200 (Sun, 04 Jun 2006) | 1 line

  Remove dangling reference
........
  r46634 | andrew.kuchling | 2006-06-04 01:59:36 +0200 (Sun, 04 Jun 2006) | 1 line

  Add more whitespace; use a better socket name
........
  r46635 | tim.peters | 2006-06-04 03:22:53 +0200 (Sun, 04 Jun 2006) | 2 lines

  Whitespace normalization.
........
  r46637 | tim.peters | 2006-06-04 05:26:02 +0200 (Sun, 04 Jun 2006) | 16 lines

  In a PYMALLOC_DEBUG build obmalloc adds extra debugging info
  to each allocated block.  This was using 4 bytes for each such
  piece of info regardless of platform.  This didn't really matter
  before (proof: no bug reports, and the debug-build obmalloc would
  have assert-failed if it was ever asked for a chunk of memory
  >= 2**32 bytes), since container indices were plain ints.  But after
  the Py_ssize_t changes, it's at least theoretically possible to
  allocate a list or string whose guts exceed 2**32 bytes, and the
  PYMALLOC_DEBUG routines would fail then (having only 4 bytes
  to record the originally requested size).

  Now we use sizeof(size_t) bytes for each of a PYMALLOC_DEBUG
  build's extra debugging fields.  This won't make any difference
  on 32-bit boxes, but will add 16 bytes to each allocation in
  a debug build on a 64-bit box.
........
  r46638 | tim.peters | 2006-06-04 05:38:04 +0200 (Sun, 04 Jun 2006) | 4 lines

  _PyObject_DebugMalloc():  The return value should add
  2*sizeof(size_t) now, not 8.  This probably accounts for
  current disasters on the 64-bit buildbot slaves.
........
  r46639 | neal.norwitz | 2006-06-04 08:19:31 +0200 (Sun, 04 Jun 2006) | 1 line

  SF #1499797, Fix for memory leak in WindowsError_str
........
  r46640 | andrew.macintyre | 2006-06-04 14:31:09 +0200 (Sun, 04 Jun 2006) | 2 lines

  Patch #1454481:  Make thread stack size runtime tunable.
........
  r46641 | andrew.macintyre | 2006-06-04 14:59:59 +0200 (Sun, 04 Jun 2006) | 2 lines

  clean up function declarations to conform to PEP-7 style.
........
  r46642 | martin.blais | 2006-06-04 15:49:49 +0200 (Sun, 04 Jun 2006) | 15 lines

  Fixes in struct and socket from merge reviews.

  - Following Guido's comments, renamed

    * pack_to -> pack_into
    * recv_buf -> recv_into
    * recvfrom_buf -> recvfrom_into

  - Made fixes to _struct.c according to Neal Norwitz comments on the checkins
    list.

  - Converted some ints into the appropriate -- I hope -- ssize_t and size_t.
........
  r46643 | ronald.oussoren | 2006-06-04 16:05:28 +0200 (Sun, 04 Jun 2006) | 3 lines

  "Import" LDFLAGS in Mac/OSX/Makefile.in to ensure pythonw gets build with
  the right compiler flags.
........
  r46644 | ronald.oussoren | 2006-06-04 16:24:59 +0200 (Sun, 04 Jun 2006) | 2 lines

  Drop Mac wrappers for the WASTE library.
........
  r46645 | tim.peters | 2006-06-04 17:49:07 +0200 (Sun, 04 Jun 2006) | 3 lines

  s_methods[]:  Stop compiler warnings by casting
  s_unpack_from to PyCFunction.
........
  r46646 | george.yoshida | 2006-06-04 19:04:12 +0200 (Sun, 04 Jun 2006) | 2 lines

  Remove a redundant word
........
  r46647 | george.yoshida | 2006-06-04 19:17:25 +0200 (Sun, 04 Jun 2006) | 2 lines

  Markup fix
........
  r46648 | martin.v.loewis | 2006-06-04 21:36:28 +0200 (Sun, 04 Jun 2006) | 2 lines

  Patch #1359618: Speed-up charmap encoder.
........
  r46649 | georg.brandl | 2006-06-04 23:46:16 +0200 (Sun, 04 Jun 2006) | 3 lines

  Repair refleaks in unicodeobject.
........
  r46650 | georg.brandl | 2006-06-04 23:56:52 +0200 (Sun, 04 Jun 2006) | 4 lines

  Patch #1346214: correctly optimize away "if 0"-style stmts
  (thanks to Neal for review)
........
  r46651 | georg.brandl | 2006-06-05 00:15:37 +0200 (Mon, 05 Jun 2006) | 2 lines

  Bug #1500293: fix memory leaks in _subprocess module.
........
  r46654 | tim.peters | 2006-06-05 01:43:53 +0200 (Mon, 05 Jun 2006) | 2 lines

  Whitespace normalization.
........
  r46655 | tim.peters | 2006-06-05 01:52:47 +0200 (Mon, 05 Jun 2006) | 16 lines

  Revert revisions:

  46640 Patch #1454481:  Make thread stack size runtime tunable.
  46647 Markup fix

  The first is causing many buildbots to fail test runs, and there
  are multiple causes with seemingly no immediate prospects for
  repairing them.  See python-dev discussion.

  Note that a branch can (and should) be created for resolving these
  problems, like

  svn copy svn+ssh://svn.python.org/python/trunk -r46640 svn+ssh://svn.python.org/python/branches/NEW_BRANCH

  followed by merging rev 46647 to the new branch.
........
  r46656 | andrew.kuchling | 2006-06-05 02:08:09 +0200 (Mon, 05 Jun 2006) | 1 line

  Mention second encoding speedup
........
  r46657 | gregory.p.smith | 2006-06-05 02:31:01 +0200 (Mon, 05 Jun 2006) | 7 lines

  bugfix: when log_archive was called with the DB_ARCH_REMOVE flag present
  in BerkeleyDB >= 4.2 it tried to construct a list out of an uninitialized
  char **log_list.

  feature: export the DB_ARCH_REMOVE flag by name in the module on BerkeleyDB >= 4.2.
........
  r46658 | gregory.p.smith | 2006-06-05 02:33:35 +0200 (Mon, 05 Jun 2006) | 5 lines

  fix a bug in the previous commit.  don't leak empty list on error return and
  fix the additional rare (out of memory only) bug that it was supposed to fix
  of not freeing log_list when the python allocator failed.
........
  r46660 | tim.peters | 2006-06-05 02:55:26 +0200 (Mon, 05 Jun 2006) | 9 lines

  "Flat is better than nested."

  Move the long-winded, multiply-nested -R support out
  of runtest() and into some module-level helper functions.
  This makes runtest() and the -R code easier to follow.
  That in turn allowed seeing some opportunities for code
  simplification, and made it obvious that reglog.txt
  never got closed.
........
  r46661 | hyeshik.chang | 2006-06-05 02:59:54 +0200 (Mon, 05 Jun 2006) | 3 lines

  Fix a potentially invalid memory access of CJKCodecs' shift-jis
  decoder.  (found by Neal Norwitz)
........
  r46663 | gregory.p.smith | 2006-06-05 03:39:52 +0200 (Mon, 05 Jun 2006) | 3 lines

    * support DBEnv.log_stat() method on BerkeleyDB >= 4.0 [patch #1494885]
........
  r46664 | tim.peters | 2006-06-05 03:43:03 +0200 (Mon, 05 Jun 2006) | 3 lines

  Remove doctest.testmod's deprecated (in 2.4) `isprivate`
  argument.  A lot of hair went into supporting that!
........
  r46665 | tim.peters | 2006-06-05 03:47:24 +0200 (Mon, 05 Jun 2006) | 2 lines

  Whitespace normalization.
........
  r46666 | tim.peters | 2006-06-05 03:48:21 +0200 (Mon, 05 Jun 2006) | 2 lines

  Make doctest news more accurate.
........
  r46667 | gregory.p.smith | 2006-06-05 03:56:15 +0200 (Mon, 05 Jun 2006) | 3 lines

    * support DBEnv.lsn_reset() method on BerkeleyDB >= 4.4 [patch #1494902]
........
  r46668 | gregory.p.smith | 2006-06-05 04:02:25 +0200 (Mon, 05 Jun 2006) | 3 lines

  mention the just committed bsddb changes
........
  r46671 | gregory.p.smith | 2006-06-05 19:38:04 +0200 (Mon, 05 Jun 2006) | 3 lines

    * add support for DBSequence objects [patch #1466734]
........
  r46672 | gregory.p.smith | 2006-06-05 20:20:07 +0200 (Mon, 05 Jun 2006) | 3 lines

  forgot to add this file in previous commit
........
  r46673 | tim.peters | 2006-06-05 20:36:12 +0200 (Mon, 05 Jun 2006) | 2 lines

  Whitespace normalization.
........
  r46674 | tim.peters | 2006-06-05 20:36:54 +0200 (Mon, 05 Jun 2006) | 2 lines

  Add missing svn:eol-style property to text files.
........
  r46675 | gregory.p.smith | 2006-06-05 20:48:21 +0200 (Mon, 05 Jun 2006) | 4 lines

    * fix DBCursor.pget() bug with keyword argument names when no data= is
      supplied [SF pybsddb bug #1477863]
........
  r46676 | andrew.kuchling | 2006-06-05 21:05:32 +0200 (Mon, 05 Jun 2006) | 1 line

  Remove use of Trove name, which isn't very helpful to users
........
  r46677 | andrew.kuchling | 2006-06-05 21:08:25 +0200 (Mon, 05 Jun 2006) | 1 line

  [Bug #1470026] Include link to list of classifiers
........
  r46679 | tim.peters | 2006-06-05 22:48:49 +0200 (Mon, 05 Jun 2006) | 10 lines

  Access _struct attributes directly instead of mucking with getattr.

  string_reverse():  Simplify.

  assertRaises():  Raise TestFailed on failure.

  test_unpack_from(), test_pack_into(), test_pack_into_fn():  never
  use `assert` to test for an expected result (it doesn't test anything
  when Python is run with -O).
........
  r46680 | tim.peters | 2006-06-05 22:49:27 +0200 (Mon, 05 Jun 2006) | 2 lines

  Add missing svn:eol-style property to text files.
........
  r46681 | gregory.p.smith | 2006-06-06 01:38:06 +0200 (Tue, 06 Jun 2006) | 3 lines

  add depends = ['md5.h']  to the _md5 module extension for correctness sake.
........
  r46682 | brett.cannon | 2006-06-06 01:51:55 +0200 (Tue, 06 Jun 2006) | 4 lines

  Add 3 more bytes to a buffer to cover constants in string and null byte on top of 10 possible digits for an int.

  Closes bug #1501223.
........
  r46684 | gregory.p.smith | 2006-06-06 01:59:37 +0200 (Tue, 06 Jun 2006) | 5 lines

  - bsddb: the __len__ method of a DB object has been fixed to return correct
    results.  It could previously incorrectly return 0 in some cases.
    Fixes SF bug 1493322 (pybsddb bug 1184012).
........
  r46686 | tim.peters | 2006-06-06 02:25:07 +0200 (Tue, 06 Jun 2006) | 7 lines

  _PySys_Init():  It's rarely a good idea to size a buffer to the
  exact maximum size someone guesses is needed.  In this case, if
  we're really worried about extreme integers, then "cp%d" can
  actually need 14 bytes (2 for "cp" + 1 for \0 at the end +
  11 for -(2**31-1)).  So reserve 128 bytes instead -- nothing is
  actually saved by making a stack-local buffer tiny.
........
  r46687 | neal.norwitz | 2006-06-06 09:22:08 +0200 (Tue, 06 Jun 2006) | 1 line

  Remove unused variable (and stop compiler warning)
........
  r46688 | neal.norwitz | 2006-06-06 09:23:01 +0200 (Tue, 06 Jun 2006) | 1 line

  Fix a bunch of parameter strings
........
  r46689 | thomas.heller | 2006-06-06 13:34:33 +0200 (Tue, 06 Jun 2006) | 6 lines

  Convert CFieldObject tp_members to tp_getset, since there is no
  structmember typecode for Py_ssize_t fields.  This should fix some of
  the errors on the PPC64 debian machine (64-bit, big endian).

  Assigning to readonly fields now raises AttributeError instead of
  TypeError, so the testcase has to be changed as well.
........
  r46690 | thomas.heller | 2006-06-06 13:54:32 +0200 (Tue, 06 Jun 2006) | 1 line

  Damn - the sentinel was missing.  And fix another silly mistake.
........
  r46691 | martin.blais | 2006-06-06 14:46:55 +0200 (Tue, 06 Jun 2006) | 13 lines

  Normalized a few cases of whitespace in function declarations.

  Found them using::

    find . -name '*.py' | while read i ; do grep 'def[^(]*( ' $i /dev/null ; done
    find . -name '*.py' | while read i ; do grep ' ):' $i /dev/null ; done

  (I was doing this all over my own code anyway, because I'd been using spaces in
  all defs, so I thought I'd make a run on the Python code as well.  If you need
  to do such fixes in your own code, you can use xx-rename or parenregu.el within
  emacs.)
........
  r46693 | thomas.heller | 2006-06-06 17:34:18 +0200 (Tue, 06 Jun 2006) | 1 line

  Specify argtypes for all test functions. Maybe that helps on strange ;-) architectures
........
  r46694 | tim.peters | 2006-06-06 17:50:17 +0200 (Tue, 06 Jun 2006) | 5 lines

  BSequence_set_range():  Rev 46688 ("Fix a bunch of
  parameter strings") changed this function's signature
  seemingly by mistake, which is causing buildbots to fail
  test_bsddb3.  Restored the pre-46688 signature.
........
  r46695 | tim.peters | 2006-06-06 17:52:35 +0200 (Tue, 06 Jun 2006) | 4 lines

  On python-dev Thomas Heller said these were committed
  by mistake in rev 46693, so reverting this part of
  rev 46693.
........
  r46696 | andrew.kuchling | 2006-06-06 19:10:41 +0200 (Tue, 06 Jun 2006) | 1 line

  Fix comment typo
........
  r46697 | brett.cannon | 2006-06-06 20:08:16 +0200 (Tue, 06 Jun 2006) | 2 lines

  Fix coding style guide bug.
........
  r46698 | thomas.heller | 2006-06-06 20:50:46 +0200 (Tue, 06 Jun 2006) | 2 lines

  Add a hack so that foreign functions returning float now do work on 64-bit
  big endian platforms.
........
  r46699 | thomas.heller | 2006-06-06 21:25:13 +0200 (Tue, 06 Jun 2006) | 3 lines

  Use the same big-endian hack as in _ctypes/callproc.c for callback functions.
  This fixes the callback function tests that return float.
........
  r46700 | ronald.oussoren | 2006-06-06 21:50:24 +0200 (Tue, 06 Jun 2006) | 5 lines

  * Ensure that "make altinstall" works when the tree was configured
    with --enable-framework
  * Also for --enable-framework: allow users to use --prefix to specify
    the location of the compatibility symlinks (such as /usr/local/bin/python)
........
  r46701 | ronald.oussoren | 2006-06-06 21:56:00 +0200 (Tue, 06 Jun 2006) | 3 lines

  A quick hack to ensure the right key-bindings for IDLE on osx: install patched
  configuration files during a framework install.
........
  r46702 | tim.peters | 2006-06-07 03:04:59 +0200 (Wed, 07 Jun 2006) | 4 lines

  dash_R_cleanup():  Clear filecmp._cache.  This accounts for
  different results across -R runs (at least on Windows) of
  test_filecmp.
........
  r46705 | tim.peters | 2006-06-07 08:57:51 +0200 (Wed, 07 Jun 2006) | 17 lines

  SF patch 1501987:  Remove randomness from test_exceptions,
  from ?iga Seilnacht (sorry about the name, but Firefox
  on my box can't display the first character of the name --
  the SF "Unix name" is zseil).

  This appears to cure the oddball intermittent leaks across
  runs when running test_exceptions under -R.  I'm not sure
  why, but I'm too sleepy to care ;-)

  The thrust of the SF patch was to remove randomness in the
  pickle protocol used.  I changed the patch to use
  range(pickle.HIGHEST_PROTOCOL + 1), to try both pickle and
  cPickle, and randomly mucked with other test lines to put
  statements on their own lines.

  Not a bugfix candidate (this is fiddling new-in-2.5 code).
........
  r46706 | andrew.kuchling | 2006-06-07 15:55:33 +0200 (Wed, 07 Jun 2006) | 1 line

  Add an SQLite introduction, taken from the 'What's New' text
........
  r46708 | andrew.kuchling | 2006-06-07 19:02:52 +0200 (Wed, 07 Jun 2006) | 1 line

  Mention other placeholders
........
  r46709 | andrew.kuchling | 2006-06-07 19:03:46 +0200 (Wed, 07 Jun 2006) | 1 line

  Add an item; also, escape %
........
  r46710 | andrew.kuchling | 2006-06-07 19:04:01 +0200 (Wed, 07 Jun 2006) | 1 line

  Mention other placeholders
........
  r46716 | ronald.oussoren | 2006-06-07 20:57:44 +0200 (Wed, 07 Jun 2006) | 2 lines

  Move Mac/OSX/Tools one level up
........
  r46717 | ronald.oussoren | 2006-06-07 20:58:01 +0200 (Wed, 07 Jun 2006) | 2 lines

  Move Mac/OSX/PythonLauncher one level up
........
  r46718 | ronald.oussoren | 2006-06-07 20:58:42 +0200 (Wed, 07 Jun 2006) | 2 lines

  mv Mac/OSX/BuildScript one level up
........
  r46719 | ronald.oussoren | 2006-06-07 21:02:03 +0200 (Wed, 07 Jun 2006) | 2 lines

  Move Mac/OSX/* one level up
........
  r46720 | ronald.oussoren | 2006-06-07 21:06:01 +0200 (Wed, 07 Jun 2006) | 2 lines

  And the last bit: move IDLE one level up and adjust makefiles
........
  r46723 | ronald.oussoren | 2006-06-07 21:38:53 +0200 (Wed, 07 Jun 2006) | 4 lines

  - Patch the correct version of python in the Info.plists at build time, instead
  of relying on a maintainer to update them before releases.
  - Remove the now empty Mac/OSX directory
........
  r46727 | ronald.oussoren | 2006-06-07 22:18:44 +0200 (Wed, 07 Jun 2006) | 7 lines

  * If BuildApplet.py is used as an applet it starts with a version of
    sys.exutable that isn't usuable on an #!-line. That results in generated
    applets that don't actually work. Work around this problem by resetting
    sys.executable.
  * argvemulator.py didn't work on intel macs. This patch fixes this
    (bug #1491468)
........
  r46728 | tim.peters | 2006-06-07 22:40:06 +0200 (Wed, 07 Jun 2006) | 2 lines

  Whitespace normalization.
........
  r46729 | tim.peters | 2006-06-07 22:40:54 +0200 (Wed, 07 Jun 2006) | 2 lines

  Add missing svn:eol-style property to text files.
........
  r46730 | thomas.heller | 2006-06-07 22:43:06 +0200 (Wed, 07 Jun 2006) | 7 lines

  Fix for foreign functions returning small structures on 64-bit big
  endian machines.  Should fix the remaininf failure in the PPC64
  Debian buildbot.

  Thanks to Matthias Klose for providing access to a machine to debug
  and test this.
........
  r46731 | brett.cannon | 2006-06-07 23:48:17 +0200 (Wed, 07 Jun 2006) | 2 lines

  Clarify documentation for bf_getcharbuffer.
........
  r46735 | neal.norwitz | 2006-06-08 07:12:45 +0200 (Thu, 08 Jun 2006) | 1 line

  Fix a refleak in recvfrom_into
........
  r46736 | gregory.p.smith | 2006-06-08 07:17:08 +0200 (Thu, 08 Jun 2006) | 9 lines

  - bsddb: the bsddb.dbtables Modify method now raises the proper error and
    aborts the db transaction safely when a modifier callback fails.
    Fixes SF python patch/bug #1408584.

  Also cleans up the bsddb.dbtables docstrings since thats the only
  documentation that exists for that unadvertised module.  (people
  really should really just use sqlite3)
........
  r46737 | gregory.p.smith | 2006-06-08 07:38:11 +0200 (Thu, 08 Jun 2006) | 4 lines

  * Turn the deadlock situation described in SF bug #775414 into a
    DBDeadLockError exception.
  * add the test case for my previous dbtables commit.
........
  r46738 | gregory.p.smith | 2006-06-08 07:39:54 +0200 (Thu, 08 Jun 2006) | 2 lines

  pasted set_lk_detect line in wrong spot in previous commit.  fixed.  passes tests this time.
........
  r46739 | armin.rigo | 2006-06-08 12:56:24 +0200 (Thu, 08 Jun 2006) | 6 lines

  (arre, arigo)  SF bug #1350060

  Give a consistent behavior for comparison and hashing of method objects
  (both user- and built-in methods).  Now compares the 'self' recursively.
  The hash was already asking for the hash of 'self'.
........
  r46740 | andrew.kuchling | 2006-06-08 13:56:44 +0200 (Thu, 08 Jun 2006) | 1 line

  Typo fix
........
  r46741 | georg.brandl | 2006-06-08 14:45:01 +0200 (Thu, 08 Jun 2006) | 2 lines

  Bug #1502750: Fix getargs "i" format to use LONG_MIN and LONG_MAX for bounds checking.
........
  r46743 | georg.brandl | 2006-06-08 14:54:13 +0200 (Thu, 08 Jun 2006) | 2 lines

  Bug #1502728: Correctly link against librt library on HP-UX.
........
  r46745 | georg.brandl | 2006-06-08 14:55:47 +0200 (Thu, 08 Jun 2006) | 3 lines

  Add news for recent bugfix.
........
  r46746 | georg.brandl | 2006-06-08 15:31:07 +0200 (Thu, 08 Jun 2006) | 4 lines

  Argh. "integer" is a very confusing word ;)
  Actually, checking for INT_MAX and INT_MIN is correct since
  the format code explicitly handles a C "int".
........
  r46748 | nick.coghlan | 2006-06-08 15:54:49 +0200 (Thu, 08 Jun 2006) | 1 line

  Add functools.update_wrapper() and functools.wraps() as described in PEP 356
........
  r46751 | georg.brandl | 2006-06-08 16:50:21 +0200 (Thu, 08 Jun 2006) | 4 lines

  Bug #1502805: don't alias file.__exit__ to file.close since the
  latter can return something that's true.
........
  r46752 | georg.brandl | 2006-06-08 16:50:53 +0200 (Thu, 08 Jun 2006) | 3 lines

  Convert test_file to unittest.
........
2006-06-08 15:35:45 +00:00
Neal Norwitz 090b3dde06 No need to export PySTEntry_New, it is only used in symtable.c 2006-02-28 22:36:46 +00:00
Neal Norwitz 8208b64670 Fix icc warnings: single bit fields should be unsigned 2006-01-07 21:25:23 +00:00
Neal Norwitz 62c2fac9a0 Do not pollute name block_ty, prefix with _Py_ 2005-10-24 00:30:44 +00:00
Neil Schemenauer 8b528b28f1 Fix private name mangling. The symtable also must do mangles so that
the scope of names can be correctly determined.
2005-10-23 18:37:42 +00:00
Neal Norwitz 6d777bb122 Remove dup declarations after AST merge 2005-10-21 04:19:49 +00:00
Jeremy Hylton 3e0055f8c6 Merge ast-branch to head
This change implements a new bytecode compiler, based on a
transformation of the parse tree to an abstract syntax defined in
Parser/Python.asdl.

The compiler implementation is not complete, but it is in stable
enough shape to run the entire test suite excepting two disabled
tests.
2005-10-20 19:59:25 +00:00
Raymond Hettinger 354433a59d SF patch #872326: Generator expression implementation
(Code contributed by Jiwon Seo.)

The documentation portion of the patch is being re-worked and will be
checked-in soon.  Likewise, PEP 289 will be updated to reflect Guido's
rationale for the design decisions on binding behavior (as described in
in his patch comments and in discussions on python-dev).

The test file, test_genexps.py, is written in doctest format and is
meant to exercise all aspects of the the patch.  Further additions are
welcome from everyone.  Please stress test this new feature as much as
possible before the alpha release.
2004-05-19 08:20:33 +00:00
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
Martin v. Löwis 95292d6caa Constify filenames and scripts. Fixes #651362. 2002-12-11 14:04:59 +00:00
Mark Hammond 91a681debf Excise DL_EXPORT from Include.
Thanks to Skip Montanaro and Kalle Svensson for the patches.
2002-08-12 07:21:58 +00:00
Jeremy Hylton 1abf610b15 Remove st_nested_scopes from struct symtable,
because nested scopes are always enabled.

(Accidentally checked in one small change along this path yesterday,
wreaking havoc in the Windows build.)
2001-08-11 21:51:24 +00:00
Tim Peters 5ca576ed0a Merging the gen-branch into the main line, at Guido's direction. Yay!
Bugfix candidate in inspect.py:  it was referencing "self" outside of
a method.
2001-06-18 22:08:13 +00:00
Jeremy Hylton 2e2cded1b5 Set the line number correctly for a nested function with an exec or
import *.  Mark the offending stmt rather than the function def line.
2001-03-22 03:57:58 +00:00
Jeremy Hylton 99858b53fc add DEF_BOUND 2001-02-28 23:03:39 +00:00
Jeremy Hylton 4db62b1e14 Improved __future__ parser; still more to do
Makefile.pre.in: add target future.o

Include/compile.h: define PyFutureFeaters and PyNode_Future()
                   add c_future slot to struct compiling

Include/symtable.h: add st_future slot to struct symtable

Python/future.c: implementation of PyNode_Future()

Python/compile.c: use PyNode_Future() for nested_scopes support

Python/symtable.c: include compile.h to pick up PyFutureFeatures decl
2001-02-27 19:07:02 +00:00
Jeremy Hylton 29906eef3a Preliminary support for future nested scopes
compile.h: #define NESTED_SCOPES_DEFAULT 0 for Python 2.1
           __future__ feature name: "nested_scopes"

symtable.h: Add st_nested_scopes slot.  Define flags to track exec and
    import star.

Lib/test/test_scope.py: requires nested scopes

compile.c: Fiddle with error messages.

    Reverse the sense of ste_optimized flag on
    PySymtableEntryObjects.  If it is true, there is an optimization
    conflict.

    Modify get_ref_type to respect st_nested_scopes flags.

    Refactor symtable_load_symbols() into several smaller functions,
    which use struct symbol_info to share variables.  In new function
    symtable_update_flags(), raise an error or warning for import * or
    bare exec that conflicts with nested scopes.  Also, modify handle
    for free variables to respect st_nested_scopes flag.

    In symtable_init() assign st_nested_scopes flag to
    NESTED_SCOPES_DEFAULT (defined in compile.h).

    Add preliminary and often incorrect implementation of
    symtable_check_future().

    Add symtable_lookup() helper for future use.
2001-02-27 04:23:34 +00:00
Jeremy Hylton cb17ae8b19 Relax the rules for using 'from ... import *' and exec in the presence
of nested functions.  Either is allowed in a function if it contains
no defs or lambdas or the defs and lambdas it contains have no free
variables.  If a function is itself nested and has free variables,
either is illegal.

Revise the symtable to use a PySymtableEntryObject, which holds all
the revelent information for a scope, rather than using a bunch of
st_cur_XXX pointers in the symtable struct.  The changes simplify the
internal management of the current symtable scope and of the stack.

Added new C source file: Python/symtable.c.  (Does the Windows build
process need to be updated?)

As part of these changes, the initial _symtable module interface
introduced in 2.1a2 is replaced.  A dictionary of
PySymtableEntryObjects are returned.
2001-02-09 22:22:18 +00:00
Jeremy Hylton 5acc0c0cfc Fix symbol table pass to generation SyntaxError exceptions that
include the filename and line number.
2001-02-02 20:01:10 +00:00
Jeremy Hylton 4b38da664c Move a bunch of definitions that were internal to compile.c to
symtable.h, so that they can be used by external module.

Improve error handling in symtable_enter_scope(), which return an
error code that went unchecked by most callers. XXX The error handling
in symtable code is sloppy in general.

Modify symtable to record the line number that begins each scope.
This can help to identify which code block is being referred to when
multiple blocks are bound to the same name.

Add st_scopes dict that is used to preserve scope info when
PyNode_CompileSymtable() is called.  Otherwise, this information is
tossed as soon as it is no longer needed.

Add Py_SymtableString() to pythonrun; analogous to Py_CompileString().
2001-02-02 18:19:15 +00:00