Commit Graph

17176 Commits

Author SHA1 Message Date
Andrew M. Kuchling 694e1816c2 Fix markup nit pointed out by FLD 2001-03-01 01:02:52 +00:00
Jeremy Hylton 5125773ff1 Don't add global names to st->st_global if we're already iterating
over the elements of st->st_global!
2001-03-01 00:42:55 +00:00
Guido van Rossum cd81ea1708 Use
find $(srcdir)/Lib -name '*.py[co]' -print | xargs rm -f

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?
2001-03-01 00:36:53 +00:00
Ka-Ping Yee 895e8925d6 Call main routine in pydoc module (pydoc.cli). 2001-03-01 00:25:40 +00:00
Ka-Ping Yee 1d384634bf 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().
2001-03-01 00:24:32 +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 3dd5ad3b4f undo introduction of st_global_star 2001-02-28 23:47:55 +00:00
Guido van Rossum 1874c8f23b Document PyErr_WarnExplicit(). 2001-02-28 23:46:44 +00:00
Jeremy Hylton c176132d63 Warn about global statement at the module level.
Do better accounting for global variables.
2001-02-28 23:44:45 +00:00
Guido van Rossum 56ba72a563 Document warn_explicit(). 2001-02-28 23:34:21 +00:00
Jack Jansen f1d7b41fa0 Disable GetWindowSpareFlag and GetWindowGoAwayBox on carbon. 2001-02-28 23:32:42 +00:00
Jeremy Hylton 42efed0fc3 update output to reflect exception that is now raised 2001-02-28 23:24:22 +00:00
Jack Jansen 0b7c4f2dea Put PPC distributions back in, rearranged packages and use VISE variable magic to determine which ConfigurePythonXXX to run. 2001-02-28 23:23:31 +00:00
Jeremy Hylton 99858b53fc add DEF_BOUND 2001-02-28 23:03:39 +00:00
Fred Drake 7840a9cb99 Add entry for the inspect module. 2001-02-28 23:02:20 +00:00
Fred Drake 6dbd382ec8 Clean up some of the markup for consistency, wrap some long lines. 2001-02-28 23:01:38 +00:00
Fred Drake bca60c07b3 Fix some rules broken by typos, others by the flattening of the makefile. 2001-02-28 22:59:37 +00:00
Jeremy Hylton 4419ac1a97 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.
2001-02-28 22:54:51 +00:00
Jeremy Hylton 150a6640f5 Fix filter for SyntaxErrors 2001-02-28 22:50:15 +00:00
Andrew M. Kuchling 3da989c6bc Fix for bug #405007: prefix subdir to scripts in order to build in
a subdirectory.
2001-02-28 22:49:26 +00:00
Andrew M. Kuchling 8bad993dd3 Add description of PEP235
Remove references to 2.1alpha
Update description of PEP229
2001-02-28 22:39:15 +00:00
Guido van Rossum 3756fa3e11 Move a comment around to where it belongs (the code had alrady been
moved).
2001-02-28 22:26:36 +00:00
Andrew M. Kuchling 74d18ed076 Cover pydoc
Update reference Python version to beta1
Rip out PEP 232 section
Add placeholders for PEP 236 and 235
Fix erroneous \filename references
2001-02-28 22:22:40 +00:00
Andrew M. Kuchling bf140147d8 Document the object allocator
Minor sentence change
2001-02-28 22:10:07 +00:00
Guido van Rossum ee34ac124a Let's have some sanity. Introduce a helper to issue a symbol table
warning.
2001-02-28 22:08:12 +00:00
Skip Montanaro 58177b9975 added description of NL token 2001-02-28 22:05:41 +00:00
Guido van Rossum 0bba7f83f2 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.
2001-02-28 21:55:38 +00:00
Fred Drake 9da7f3b4f4 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.
2001-02-28 21:52:10 +00:00
Fred Drake 9c98a428ef 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.)
2001-02-28 21:46:37 +00:00
Guido van Rossum 2fd456508f Add PyErr_WarnExplicit(), which calls warnings.warn_explicit(), with
explicit filename, lineno etc. arguments.
2001-02-28 21:46:24 +00:00
Guido van Rossum 1bcb7e9327 Add declaration for PyErr_WarnExplicit(). 2001-02-28 21:44:20 +00:00
Guido van Rossum 9e26318975 Add a new API:
warn_explicit(message, category, filename, lineno, module, registry)

The regular warn() call calculates a bunch of values and calls
warn_explicit() with these.

This will be used to issue better syntax warnings.
2001-02-28 21:43:40 +00:00
Andrew M. Kuchling d6a1d79d16 Mention pydoc 2001-02-28 21:05:42 +00:00
Andrew M. Kuchling 3a95850323 Leave #! lines featuring /usr/bin/env alone 2001-02-28 20:59:33 +00:00
Fred Drake b797f1f6d2 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.
2001-02-28 20:58:04 +00:00
Andrew M. Kuchling aece4270b1 Install the pydoc script 2001-02-28 20:56:49 +00:00
Andrew M. Kuchling b68ef5081d 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.
2001-02-28 20:55:10 +00:00
Andrew M. Kuchling b69c758f3b Fix for bug #404875: fix typo in setup.py 2001-02-28 19:49:57 +00:00
Andrew M. Kuchling 6335773434 Placate tabnanny 2001-02-28 19:40:27 +00:00
Fred Drake 3e038e5e25 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.
2001-02-28 17:56:26 +00:00
Jeremy Hylton 62e2c7e3df Add regression test for future statements. This adds eight files, but
seven are not tests in their own right; these files are mentioned in
regrtest.
2001-02-28 17:48:06 +00:00
Jeremy Hylton ad3d3f2f3f Improve SyntaxErrors for bad future statements. Set file and location
for errors raised in future.c.

Move some helper functions from compile.c to errors.c and make them
API functions: PyErr_SyntaxLocation() and PyErr_ProgramText().
2001-02-28 17:47:12 +00:00
Tim Peters 5687ffe0c5 SF patch 404928: Support for next Cygwin gcc (2.95.2-8) 2001-02-28 16:44:18 +00:00
Jack Jansen c6cecf55d1 Reset the resource file chain before calling PyMac_OpenPrefFile. I'm not sure why this wasn't a problem before... 2001-02-28 15:54:18 +00:00
Jack Jansen f7fb3e6435 Oops, need to import Res. 2001-02-28 15:53:18 +00:00
Jack Jansen 72b97aed80 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. 2001-02-28 11:23:04 +00:00
Tim Peters 85ba673b0a Whitespace normalization. 2001-02-28 08:26:44 +00:00
Tim Peters 8de0c1716b Removed now-unreferenced CHECK_IMPORT_CASE from Windows config.h.
NOTE:  someone who understands Unix config should remove it from acconfig.h too.
2001-02-28 08:15:16 +00:00
Jeremy Hylton 9f1b9932b8 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.
2001-02-28 07:07:43 +00:00
Tim Peters e860f9b983 Ack -- my eyes are getting bleary. Typos in the comment typo repairs. 2001-02-28 05:57:51 +00:00