Tim Peters [Thu, 1 Mar 2001 01:30:56 +0000 (01:30 +0000)]
In Steven's apparent absence, check in *something* with a non-zero chance
of making new-fangled Mac imports work again. May not work, and may not
even compile on his boxes, but should be at worst very close on both.
to remove all .py[co] files before testing, rather than just those in
the Lib/test directory. "find" is used all over the Makefile so I
suppose it's safe; how about xargs?
Ka-Ping Yee [Thu, 1 Mar 2001 00:24:32 +0000 (00:24 +0000)]
Normalize case of paths in sys.path to avoid duplicates on Windows.
Handle <... at 001B6378> like <... at 0x120f80> (%p is platform-dependent).
Fix RCS version tag handling.
Move __main__ behaviour into a function, pydoc.cli().
Jeremy Hylton [Wed, 28 Feb 2001 22:54:51 +0000 (22:54 +0000)]
Add warning/error handlin for problematic nested scopes cases as
described in PEP 227.
symtable_check_unoptimized() warns about import * and exec with "in"
when it is used in a function that contains a nested function with
free variables. Warnings are issued unless nested scopes are in
effect, in which case these are SyntaxErrors.
symtable_check_shadow() warns about assignments in a function scope
that shadow free variables defined in a nested scope. This will
always generate a warning -- and will behave differently with nested
scopes than without.
Restore full checking for free vars in children, even when nested
scopes are not enabled. This is needed to support warnings for
shadowing.
Change symtable_warn() to return an int-- the return value of
PyErr_WarnExplicit.
Sundry cleanup: Remove commented out code. Break long lines.
Guido van Rossum [Wed, 28 Feb 2001 21:55:38 +0000 (21:55 +0000)]
Use the new PyErr_WarnExplicit() API to issue better warnings for
global after assign / use.
Note: I'm not updating the PyErr_Warn() call for import * / exec
combined with a function, because I can't trigger it with an example.
Jeremy, just follow the example of the call to PyErr_WarnExplicit()
that I *did* include.
Fred Drake [Wed, 28 Feb 2001 21:52:10 +0000 (21:52 +0000)]
SyntaxError__init__(): Be a little more robust when picking apart the
location information for the SyntaxError -- do not do more than we
need to, stopping as soon as an exception has been raised.
Fred Drake [Wed, 28 Feb 2001 21:46:37 +0000 (21:46 +0000)]
Move some constant initialization from FTP.__init__() and FTP.connect()
to the class namespace.
Allow FTP.close() to be called more than once without tossing cookies.
(This seems to be a fairly common idiom for .close() methods, so let's
try to be consistent.)
Fred Drake [Wed, 28 Feb 2001 20:58:04 +0000 (20:58 +0000)]
Now that Jeremy is asking about this code, it looks really bogus to me,
so let's rip it out. The constructor for SyntaxError does the right
thing, so we do not need to do it again.
Add script form of pydoc so that it's present in beta1. Currently
this just copies the __name__=='__main__' logic from pydoc.py.
?!ng can decide whether he wants to create a main() in pydoc, or rip
it out of pydoc.py completely.
Fred Drake [Wed, 28 Feb 2001 17:56:26 +0000 (17:56 +0000)]
Define lots of constants for indexes into the structures for the file
header and central directory structures, and use them as appropriate.
The point being to make it easier to tell what is getting pulled out
where; magic numbers are evil!
Change the computation of the ZipInfo.file_offset field to use the
length of the relevant "extra" field -- there are two different ones,
and the wrong one had been used. ;-(
This closes SF tracker patch #403276, but more verbosely than the
proposed patch.
Jack Jansen [Wed, 28 Feb 2001 11:23:04 +0000 (11:23 +0000)]
If we can't find our splash dialog (i.e. we're probably running from source) go into interactive mode: print what we're doing and ask about carbon/classic configure.
Jeremy Hylton [Wed, 28 Feb 2001 07:07:43 +0000 (07:07 +0000)]
Print the offending line of code in the traceback for SyntaxErrors
raised by the compiler.
XXX For now, text entered into the interactive intepreter is not
printed in the traceback.
Inspired by a patch from Roman Sulzhyk
compile.c:
Add helper fetch_program_text() that opens a file and reads until it
finds the specified line number. The code is a near duplicate of
similar code in traceback.c.
Modify com_error() to pass two arguments to SyntaxError constructor,
where the second argument contains the offending text when possible.
Modify set_error_location(), now used only by the symtable pass, to
set the text attribute on existing exceptions.
pythonrun.c:
Change parse_syntax_error() to continue of the offset attribute of a
SyntaxError is None. In this case, it sets offset to -1.
Move code from PyErr_PrintEx() into helper function
print_error_text(). In the helper, only print the caret for a
SyntaxError if offset > 0.
Tim Peters [Wed, 28 Feb 2001 05:34:27 +0000 (05:34 +0000)]
Implement PEP 235: Import on Case-Insensitive Platforms.
http://python.sourceforge.net/peps/pep-0235.html
Renamed check_case to case_ok. Substantial code rearrangement to get
this stuff in one place in the file. Innermost loop of find_module()
now much simpler and #ifdef-free, and I want to keep it that way (it's
bad enough that the innermost loop is itself still in an #ifdef!).
Windows semantics tested and are fine.
Jason, Cygwin *should* be fine if and only if what you did before "worked"
for case_ok.
Jack, the semantics on your flavor of Mac have definitely changed (see
the PEP), and need to be tested. The intent is that your flavor of Mac
now work the same as everything else in the "lower left" box, including
respecting PYTHONCASEOK.
Steven, sorry, you did the most work here so far but you got screwed the
worst. Happy to work with you on repairing it, but I don't understand
anything about all your Mac variants. We need to add another branch (or
two, three, ...?) inside case_ok. But we should not need to change
anything else.
Fred Drake [Wed, 28 Feb 2001 05:34:16 +0000 (05:34 +0000)]
Added regression test for SF tracker bug #403871: AttributeError in
ZipFile.__del__() when there was an IOError opening the underlying
file in ZipFile.__init__().
This is an odd test: since the exception is in the __del__() method,
it is not propogated. This test will trigger it but regrtest.py
does not detect the failure (not sure why); we are dependent on it
actually being noticed by a user to get a new bug report if it ever
fails. ;-(
On the other hand, this makes sure that code gets exercised, so
a failure could be noticed!
Jeremy Hylton [Wed, 28 Feb 2001 01:58:08 +0000 (01:58 +0000)]
Presumed correct compiler pass for future statements
XXX still need to integrate into symtable API
compile.h: Remove ff_n_simple_stmt; obsolete.
Add ff_found_docstring used internally to skip one and only
one string at the beginning of a module.
compile.c: Add check for from __future__ imports to far into the file.
In symtable_global() check for -1 returned from
symtable_lookup(), which signifies name not defined.
Add missing DECERF in symtable_add_def.
Free c->c_future.
future.c: Add special handling for multiple statements joined on a
single line using one or more semicolons; this form can
include an illegal future statement that would otherwise be
hard to detect.
Add support for detecting and skipping doc strings.
Fred Drake [Tue, 27 Feb 2001 21:35:40 +0000 (21:35 +0000)]
Replace all the platform-specific TERMIOS modules with a portable version
based on the termios module. The only added "feature" is the deprecation
warning it spits out.
Patch #404680: disables the nis module and enables the dl module when
building under Cygwin. Makes some fixes to the dlmodule in order to
compile with Cygwin.
Patch #403947: On Cygwin, use the Unix compiler class, and not
the Cygwin-specific compiler class.
(According to Jason Tishler, cygwinccompiler needs some work to
handle the differences in Cygwin- and MSVC-Python. Makefile and
config files are currently ignored by cygwinccompiler, as it was
written to support cygwin for extensions which are intended to be
used with the standard MSVC built Python.)
Fred Drake [Tue, 27 Feb 2001 18:56:46 +0000 (18:56 +0000)]
Gustavo Niemeyer <niemeyer@conectiva.com>:
Fixed recno support (keys are integers rather than strings).
Work around DB bug that cause stdin to be closed by rnopen() when the
DB file needed to exist but did not (no longer segfaults).
This closes SF tracker patch #403445.
Also wrapped some long lines and added whitespace around operators -- FLD.
Neil Schemenauer [Tue, 27 Feb 2001 18:50:56 +0000 (18:50 +0000)]
Change EXEEXT back to EXE in the Makefile. Other tools may depend on the name.
The name in configure is still EXEEXT because that's what autoconf calls it.
Also, replace a few occurrences of "python" with "$(PYTHON)".