Commit Graph

17169 Commits

Author SHA1 Message Date
Jeremy Hylton bc32024769 Extend support for from __future__ import nested_scopes
If a module has a future statement enabling nested scopes, they are
also enable for the exec statement and the functions compile() and
execfile() if they occur in the module.

If Python is run with the -i option, which enters interactive mode
after executing a script, and the script it runs enables nested
scopes, they are also enabled in interactive mode.

XXX The use of -i with -c "from __future__ import nested_scopes" is
not supported.  What's the point?

To support these changes, many function variants have been added to
pythonrun.c.  All the variants names end with Flags and they take an
extra PyCompilerFlags * argument.  It is possible that this complexity
will be eliminated in a future version of the interpreter in which
nested scopes are not optional.
2001-03-22 02:47:58 +00:00
Jeremy Hylton 061d106a0f If a code object is compiled with nested scopes, define the CO_NESTED flag.
Add PyEval_GetNestedScopes() which returns a non-zero value if the
code for the current interpreter frame has CO_NESTED defined.
2001-03-22 02:32:48 +00:00
Guido van Rossum f6e47ad4bd Check that f.keys() == [] right after creation -- this prevents bugs
like the one I just fixed to come back and haunt us.
2001-03-22 00:40:23 +00:00
Neil Schemenauer 4edbc2a54f Add CONFIG_ARGS Makefile variable (saves the arguments passed
to configure).
2001-03-22 00:34:03 +00:00
Neil Schemenauer 64b1b686d1 - Remove WITH makefile variable. Its not used for anything.
- Add CONFIG_ARGS variable and use it to re-run configure rather than
  using config.status.  This prevents an infinite loop if configure
  dies while re-configuring.
2001-03-22 00:32:32 +00:00
Guido van Rossum ec24c1bc32 Don't raise MemoryError in keys() when the database is empty.
This fixes SF bug #410146 (python 2.1b shelve is broken).
2001-03-22 00:19:22 +00:00
Tim Peters 24a4191160 Changed doctest to run tests in alphabetic order of name.
This makes verbose-mode output easier to dig thru, and removes an accidental
dependence on the order of dict.items() (made visible by recent changes to
dictobject.c).
2001-03-21 23:07:59 +00:00
Fred Drake c392b570db Integrated an expanded version of some text from Neil Schemenauer about
supporting cyclic garbage collection.  (This is not all of it, but I'm
taking a break!)

Also fixed some markup nits.
2001-03-21 22:15:01 +00:00
Jeremy Hylton 09ccc3a22a Test that traceback module works with SyntaxErrors with or without carets. 2001-03-21 20:33:04 +00:00
Jeremy Hylton ed9d0ba482 Do not print caret when offset is None. 2001-03-21 20:29:18 +00:00
Tim Peters 6783070ebf Make PyDict_Next safe to use for loops that merely modify the values
associated with existing dict keys.
This is a variant of part of Michael Hudson's patch #409864 "lazy fix for
Pings bizarre scoping crash".
2001-03-21 19:23:56 +00:00
Guido van Rossum 66b0e9c2a7 Use PyObject_IsInstance() to check whether the first argument to an
unbound method is of the right type.  Hopefully this solves SF patch
#409355 (Meta-class inheritance problem); I have no easy way to test.
2001-03-21 19:17:22 +00:00
Jeremy Hylton 69e9e8bd51 Reformat and edit docstrings to follow modern conventions. Single
line summary followed by blank line and description.
2001-03-21 19:09:31 +00:00
Jeremy Hylton ded4bd776f Update PyNode_CompileSymtable() to understand future statements 2001-03-21 19:01:33 +00:00
Guido van Rossum 823649d544 Move the code implementing isinstance() and issubclass() to new C
APIs, PyObject_IsInstance() and PyObject_IsSubclass() -- both
returning an int, or -1 for errors.
2001-03-21 18:40:58 +00:00
Fred Drake 91751143eb Add test cases for the fnmatch module. 2001-03-21 18:29:25 +00:00
Fred Drake cd1b1dd6d2 Just import sys at the top instead of inside lots of functions.
Add some helpers for supporting PyUNIT-based unit testing.
2001-03-21 18:26:33 +00:00
Fred Drake 02538200b3 The unittest module from PyUNIT, by Steve Purcell. 2001-03-21 18:09:46 +00:00
Fred Drake 46d9fda008 Donovan Baarda <abo@users.sourceforge.net>:
Patch to make "\" in a character group work properly.

This closes SF bug #409651.
2001-03-21 18:05:48 +00:00
Moshe Zadka 22710823fb Fixed a bunch of Tabnanny errors 2001-03-21 17:24:49 +00:00
Jeremy Hylton 5c7a2513ec Add tests for recent changes:
- global stmt in class does not affect free vars in methods
- locals() works with free and cell vars
2001-03-21 16:44:39 +00:00
Jeremy Hylton 220ae7c0bf Fix PyFrame_FastToLocals() and counterpart to deal with cells and
frees.  Note there doesn't seem to be any way to test LocalsToFast(),
because the instructions that trigger it are illegal in nested scopes
with free variables.

Fix allocation strategy for cells that are also formal parameters.
Instead of emitting LOAD_FAST / STORE_DEREF pairs for each parameter,
have the argument handling code in eval_code2() do the right thing.

A side-effect of this change is that cell variables that are also
arguments are listed at the front of co_cellvars in the order they
appear in the argument list.
2001-03-21 16:43:47 +00:00
Martin v. Löwis bec1958d97 Use proper compiler flags on UnixWare.
Closes bug #231439.
2001-03-21 15:57:54 +00:00
Guido van Rossum f74c9dc870 Add newline to end of file. 2001-03-21 14:18:12 +00:00
Martin v. Löwis be0e7f4262 Document tix directory. 2001-03-21 11:47:55 +00:00
Martin v. Löwis 0411f6f135 Add section on 2.1b2.
Report the addition of the Tix module.
2001-03-21 08:01:39 +00:00
Martin v. Löwis b1d196927a Remove Tix detection from Tkinter part; lib-tk/Tix attempts to load Tix
by requiring it. Also remove commentary from Setup.dist about commenting
in and out stuff.
2001-03-21 07:44:53 +00:00
Martin v. Löwis b21cb5fa7d Patch #410231: Add the Python Tix library. 2001-03-21 07:42:07 +00:00
Martin v. Löwis 2c91c815d4 Patch #409504: Fix regex problems, consider \-continuation lines in Makefile
and Setup.
2001-03-21 06:58:25 +00:00
Tim Peters 55f826cd6a Update Windows installer for 2.1b2. 2001-03-21 06:09:14 +00:00
Tim Peters eba5130e4f Addrf simple test that import is case-sensitive. 2001-03-21 03:58:16 +00:00
Jack Jansen 9de05f4157 Started on 2.1b2 release notes. Cleaned out alfa notes, etc. 2001-03-20 23:30:38 +00:00
Jack Jansen 875b51dff9 Added dummy _tkinter module for Carbon, which explains that Tkinter isnt supported under Carbon. 2001-03-20 23:30:06 +00:00
Jack Jansen aabdb0d5bf Dummy _tkinter module for Carbon, which explains that Tkinter isnt supported under Carbon. 2001-03-20 23:29:41 +00:00
Fred Drake 4e6d09e369 Moved the description of the tzparse module to the "Obsolete" section
and note that it fails when the TZ environment variable is not set.

This closes SF bug #409683.
2001-03-20 23:13:53 +00:00
Jack Jansen 4df3c5284f Case-checking was broken on the Macintosh. Fixed. 2001-03-20 23:09:54 +00:00
Jack Jansen fddef433d1 Got module to work under Carbon. Also disabled a few more bits of cfm68k support. 2001-03-20 21:55:51 +00:00
Jack Jansen 26d42df3c1 Added riscos modules to modules that don't have to be included. 2001-03-20 21:55:07 +00:00
Guido van Rossum 6b767ac81a Lawrence Hudson, SF #401702: Modify co_filename in frozen programs
This patch was developed primarily to reduce the size of the
  frozen binary.  It is particularly useful when freezing for 'small'
  platforms, such as Palm OS, where you really want to save that
  last miserable byte.

  A limitation of this patch is that it does not provide any feedback
  about the replacements being made.  As the path matching
  is case-sensitive this may lead to unexpected behaviour for DOS
  and Windows people, eg
      > freeze.py -r C:\Python\Lib\=py\ goats.py
  should probably be:
      > freeze.py -r c:\python\lib\=py\ goats.py
2001-03-20 20:43:34 +00:00
Guido van Rossum b845cb0946 Bump version to 2.1b2. 2001-03-20 19:57:10 +00:00
Guido van Rossum d0926940b7 Add a deprecation warning to this module.
Importing it typically fails anyway (no TZ variable defined), so this
is no great loss.
2001-03-20 18:36:48 +00:00
Andrew M. Kuchling 44f5f8fb26 Bug #409419: delete seek() and tell() methods, so callers can use getattr()
to check for them (instead of calling them and then ignoring an
    IOError)
2001-03-20 15:51:14 +00:00
Moshe Zadka d3f193fe9d * Fixing the password-proxy bug
* Not sending content-type and content-length twice
2001-03-20 13:14:28 +00:00
Guido van Rossum 6abce91a34 Get rid of --with-check-import-case. (Jason Tishler, SF #409924) 2001-03-20 13:09:14 +00:00
Guido van Rossum a1351fbd88 SF patch #408326 by Robin Thomas: slice objects comparable, not
hashable

This patch changes the behavior of slice objects in the following
manner:

- Slice objects are now comparable with other slice objects as though
they were logically tuples of (start,stop,step). The tuple is not
created in the comparison function, but the comparison behavior is
logically equivalent.

- Slice objects are not hashable. With the above change to being
comparable, slice objects now cannot be used as keys in dictionaries.

[I've edited the patch for style.  Note that this fixes the problem
that dict[i:j] seemed to work but was meaningless.  --GvR]
2001-03-20 12:41:34 +00:00
Tim Peters 26ae7cd75a SF patch 407758, "timemodule patches for Cygwin", from Norman Vine.
http://sourceforge.net/tracker/?func=detail&aid=407758&group_id=5470&atid=305470
2001-03-20 03:26:49 +00:00
Jeremy Hylton ce7ef599d2 Fixup handling of free variables in methods when the class scope also
has a binding for the name.  The fix is in two places:

  - in symtable_update_free_vars, ignore a global stmt in a class scope
  - in symtable_load_symbols, add extra handling for names that are
    defined at class scope and free in a method

Closes SF bug 407800
2001-03-20 00:25:43 +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 23b4227ec8 Fix crashes in nested list comprehensions
SF bugs 409230 and 407800

Also remove bogus list comp code from symtable_assign().
2001-03-19 20:38:06 +00:00
Tim Peters baa03e80f4 When building the installer, prompt for the location of the system directory
on the current machine.  Wise doesn't seem to know this itself, and it
varies across Windows flavors.
2001-03-19 19:19:45 +00:00