Commit Graph

1486 Commits

Author SHA1 Message Date
Jeremy Hylton eab4328f1a Fix calculation of hardest_arg.
The argument properties are ordered from easiest to hardest.  The
harder the arg, the more complicated that code that must be generated
to return it from getChildren() and/or getChildNodes().  The old
calculation routine was bogus, because it always set hardest_arg to
the hardness of the last argument.  Now use max() to always set it to
the hardness of the hardest argument.
2001-09-17 20:16:30 +00:00
Jeremy Hylton 2e4cc7e0d8 Last set of change to get regression tests to pass
Remove the only test in the syntax module.  It ends up that the
transformer must handle this error case.

In the transformer, check for a list compression in com_assign_list()
by looking for a list_for node where a comma is expected.

In pycodegen.compile() re-raise the SyntaxError rather than catching
it and exiting
2001-09-17 19:33:48 +00:00
Jeremy Hylton bf80a033ee Add -p option to invoke Python profiler 2001-09-17 18:08:40 +00:00
Jeremy Hylton ce0c19c4a8 Only print attributes that start with co_.
If passed a .py file as an argument, try to find its accompanying
.pyc.
2001-09-17 18:08:20 +00:00
Jeremy Hylton 37c9351cf6 Handle more syntax errors.
Invoke compiler.syntax.check() after building AST.  If a SyntaxError
occurs, print the error and exit without generating a .pyc file.

Refactor code to use compiler.misc.set_filename() rather than passing
filename argument around to each CodeGenerator instance.
2001-09-17 18:03:55 +00:00
Jeremy Hylton 09392b77a4 Add utility to set filename attribute on all nodes 2001-09-17 18:02:21 +00:00
Jeremy Hylton aee0bfedcc support true division 2001-09-17 16:41:02 +00:00
Tim Peters a2e2dbe8cd Improve handling of docstrings. I had feared this was a case of
introspection incompatibility, but in fact it's just that calltips
always gave up on a docstring that started with a newline (but
didn't realize they were giving up <wink>).
2001-09-16 02:19:49 +00:00
Jeremy Hylton 1048aa933f Add code generator for yield stmt 2001-09-14 23:17:55 +00:00
Jeremy Hylton 6a9cac68b6 del no longer necessary now that new module is gone 2001-09-14 22:54:48 +00:00
Jeremy Hylton 1e99a77120 Various sundry changes for 2.2 compatibility
Remove the option to have nested scopes or old LGB scopes.  This has a
large impact on the code base, by removing the need for two variants
of each CodeGenerator.

Add a get_module() method to CodeGenerator objects, used to get the
future features for the current module.

Set CO_GENERATOR, CO_GENERATOR_ALLOWED, and CO_FUTURE_DIVISION flags
as appropriate.

Attempt to fix the value of nlocals in newCodeObject(), assuming that
nlocals is 0 if CO_NEWLOCALS is not defined.
2001-09-14 22:49:08 +00:00
Jeremy Hylton 652a22437a The object-being sliced in an assignment to a slice is referenced, not
bound.

When a Yield() node is visited, assign to the generator attribute of
the scope, not the visitor.
2001-09-14 22:45:57 +00:00
Jeremy Hylton 9ee78f7d61 the new new doesn't define CO_xxx as the old new did 2001-09-14 22:44:35 +00:00
Jeremy Hylton fff252d20d the names attribute of Global is not a node 2001-09-14 22:40:36 +00:00
Mark Hammond 773c83be04 Fix for bug #442374 - Modulefinder registry support broken 2001-09-05 23:42:36 +00:00
Jack Jansen 5a1516bce5 Only output the buffer size error label if it is used.
Shuts up another couple of gcc warnings.
2001-09-05 10:27:53 +00:00
Jack Jansen d157b3795b Don't use a default "int" return type, gcc gives a warning about it. 2001-09-04 22:16:33 +00:00
Guido van Rossum a0ca3d611e - Reverse the meaning of the -m option: warnings about multiple /
operators per line or statement are now on by default, and -m turns
  these warnings off.

- Change the way multiple / operators are reported; a regular
  recommendation is always emitted after the warning.

- Report ambiguous warnings (both int|long and float|complex used for
  the same operator).

- Update the doc string again to clarify all this and describe the
  possible messages more precisely.
2001-09-04 16:22:01 +00:00
Tim Peters 83e7ccc9fd Whitespace normalization. 2001-09-04 06:37:28 +00:00
Guido van Rossum 1832de4bc0 PEP 238 documented -Qwarn as warning only for classic int or long
division, and this makes sense.  Add -Qwarnall to warn for all
classic divisions, as required by the fixdiv.py tool.
2001-09-04 03:51:09 +00:00
Guido van Rossum 61c345fa37 Rename the -D option to -Q, to avoid a Jython option name conflict. 2001-09-04 03:26:15 +00:00
Guido van Rossum e7a95983b0 Implement what the docstring said: multiple slashes per line are
treated the same as single ones by default.  Added -m option to issue
a warning for this case instead.
2001-09-02 14:11:30 +00:00
Guido van Rossum 13c51ecb8c Added more text to the docstring, updated the way the exit status is
percolated out, and some general cleanup.  The output is still the
same, except it now prints "Index: <file>" instead of "Processing:
<file>", so that the output can be used as input for patch (but only
the diff-style parts of it).
2001-09-02 04:49:36 +00:00
Guido van Rossum 43db62e263 A grep-like tool that looks for division operators. 2001-09-02 04:43:30 +00:00
Guido van Rossum 822218b400 The beginnings of a script to help finding / operators that may need
to be change to //.  The code is pretty gross so far, and I promise
I'll work on this more, but I have to go eat now! :-)
2001-09-01 21:55:58 +00:00
Jeremy Hylton 71ebc3359b Fix _convert_NAME() so that it doesn't store locals for class bodies.
Fix list comp code generation -- emit GET_ITER instead of Const(0)
after the list.

Add CO_GENERATOR flag to generators.

Get CO_xxx flags from the new module
2001-08-30 20:25:55 +00:00
Jeremy Hylton f71b5fec43 spurious pop 2001-08-30 15:50:34 +00:00
Jeremy Hylton e4685ec57e Track the block stack more reasonably in order to handle continue in
try/except or try/finally.

Previous versions had only track SETUP_LOOP blocks and ignored the
exception part.  This meant that it allowed continue inside a
try/except but generated buggy code.  Now it does the right thing.
2001-08-29 22:30:09 +00:00
Jeremy Hylton 9263848fa1 Improve stack depth computation for try/except and try/finally
Add CONTINUE_LOOP to the list of unconditional transfers
2001-08-29 22:27:14 +00:00
Jeremy Hylton 4bd4dddd55 Add __getitem__() handler for use by visitContinue() 2001-08-29 22:26:35 +00:00
Jeremy Hylton 1936745668 Generate SET_LINENO for list and tuple literals when the open paren
starts a new line.

Also fix undetected typo in visitDict() -- uncovered by recent change
to add lineno attrs to atoms.
2001-08-29 20:57:43 +00:00
Jeremy Hylton 7845cf8d37 Make sure that atoms (Tuple, List, etc.) have lineno attributes 2001-08-29 20:56:30 +00:00
Jeremy Hylton 4ba9001f5c Fix off-by-one errors in code to find depth of stack.
XXX The code is still widely inaccurate, but most (all?) of the time
it's an overestimate.
2001-08-29 20:55:17 +00:00
Jeremy Hylton bf77c465bd Undo change from list to dict for handling varnames, consts, etc.
As the doc string for _lookupName() explains:

    This routine uses a list instead of a dictionary, because a
    dictionary can't store two different keys if the keys have the
    same value but different types, e.g. 2 and 2L.  The compiler
    must treat these two separately, so it does an explicit type
    comparison before comparing the values.
2001-08-29 19:45:33 +00:00
Jeremy Hylton 5a9ac97040 Change default() to use getChildNodes() instead of getChildren() 2001-08-29 18:17:22 +00:00
Jeremy Hylton 94afe32b5e Support // and //=
Generate SET_LINENO for del statements.

Define klass=1 for PyFlowGraph constructor for a class statement.  A
class has no varnames.
2001-08-29 18:14:39 +00:00
Jeremy Hylton 7abf520d6c Add support for // and //=.
Avoid if/elif/elif/else tests where the final else is supposed to
handle exactly one case instead of all other cases.  When the list of
operators is extended, the catchall else treats all new operators as
the last operator in the set of tests.  Instead, raise an exception if
an unexpected operator occurs.
2001-08-29 18:12:30 +00:00
Jeremy Hylton d4be10dc2c Add generator detection to symbol table.
Fix bug in handling of statements like "l[x:y] = 2".  The visitor was
treating this as assignments to l, x, and y!
2001-08-29 18:10:51 +00:00
Jeremy Hylton e4e9cd4c01 Modify name conversion to be (hopefully) a bit more efficient.
Use a dictionary instead of a list to map objects to their offsets in
a const/name tuple of a code object.

XXX The conversion is perhaps incomplete, in that we shouldn't have to
do the list2dict to start.
2001-08-29 18:09:50 +00:00
Jeremy Hylton 5477f529d6 Revise implementations of getChildren() and getChildNodes().
Add support for floor division (// and //=)

The implementation of getChildren() and getChildNodes() is intended to
be faster, because it avoids calling flatten() on every return value.
But it's not clear that it is a lot faster, because constructing a
tuple with just the right values ends up being slow.  (Too many
attribute lookups probably.)

The ast.txt file is much more complicated, with funny characters at
the ends of names (*, &, !) to indicate the types of each child node.

The astgen script is also much more complex, making me wonder if it's
still useful.
2001-08-29 18:08:02 +00:00
Jeremy Hylton da8db8ca18 Don't include doc string of class in its code child 2001-08-29 17:19:02 +00:00
Jeremy Hylton 2ac9c3eec5 Make sure the JUMP_ABSOLUTE and POP_BLOCK at the end of a for loop are
contiguous.
2001-08-28 17:28:33 +00:00
Jeremy Hylton 63db7b9ca1 XXX_NAME ops should affect varnames
varnames should list all the local variables (with arguments first).
The XXX_NAME ops typically occur at the module level and assignment
ops should create locals.
2001-08-28 16:36:12 +00:00
Jeremy Hylton f354575328 Generate FOR_ITER-based loops instead of old FOR_LOOP-based loops 2001-08-28 16:35:18 +00:00
Jeremy Hylton c59e220000 Handle private names
(Hard to believe these were never handled before)

Add misc.mangle() that mangles based on the rules in compile.c.
XXX Need to test the corner cases

Update CodeGenerator with a class_name attribute bound to None.  If a
particular instance is created within a class scope, the instance's
class_name is bound to that class's name.

Add mangle() method to CodeGenerator that mangles if the class_name
has a class_name in it.

Modify the FunctionCodeGenerator family to handle an extra argument--
the class_name.

Wrap all name ops and attrnames in calls to self.mangle()
2001-08-27 22:56:16 +00:00
Jeremy Hylton 80ea40d858 emit SET_LINENO for augmented assignments 2001-08-27 21:58:09 +00:00
Jeremy Hylton 2afff324ea Many changes -- bug fixes and sundry improvements
Make nested scopes enabled by default

Add is_constant_false() helper so that compiled code and symbols are
consistent with builtin compiler's handling of "if 0:"

Fix doc string handling to be consistent with recent change that
eliminates the doc string from the Module's node attribute.

Add fix to print handling from Evan & Shane.

Track change to visitor api by making "verbose" explicit.

Comment out setting CO_NESTED flag (it's unnecessary in 2.2).
2001-08-27 21:51:52 +00:00
Jeremy Hylton cd8a127e1a Fix for sibling nodes that define the same free variable
Evan Simpson's fix.  And his explanation:

    If you defined two nested functions in a row that refer to the
    same non-global variable, the second one will be generated as
    though the variable were global.
2001-08-27 21:06:35 +00:00
Jeremy Hylton 7e30c9bb5a Add lookup_name() to optimize use of stack frames
The use of com_node() introduces a lot of extra stack frames, enough
to cause a stack overflow compiling test.test_parser with the standard
interpreter recursionlimit.  The com_node() is a convenience function
that hides the dispatch details, but comes at a very high cost.  It is
more efficient to dispatch directly in the callers.  In these cases,
use lookup_node() and call the dispatched node directly.

Also handle yield_stmt in a way that will work with Python 2.1
(suggested by Shane Hathaway)
2001-08-27 21:02:51 +00:00
Jeremy Hylton 058a5adad0 Two changes to visitor API:
Remove _preorder as alias for dispatch and call dispatch directly.
    Add an extra optional argument to walk()

XXX Also comment out some code that does debugging prints.
2001-08-27 20:47:08 +00:00
Jeremy Hylton cccc478577 Why didn't I think of Fred off the top of my head? 2001-08-27 20:44:20 +00:00
Jeremy Hylton 627673396a Add everyone I can think of off the top of my head 2001-08-27 20:43:16 +00:00
Jeremy Hylton 2a8ec79353 Revise regrtest to compile entire standard library.
The tests are run from a copy of the library directory, where
everything has been compiled by the compiler package.

Add a raw_input() call at the end of the script, so that I can check
the output before the temp directory with the compiled code is
removed.
2001-08-27 20:40:43 +00:00
Jeremy Hylton 33c2a627f1 Add -c option to continue if one file has a SyntaxError 2001-08-27 20:39:21 +00:00
Jack Jansen 9403591014 Fixes by Thomas Heller:
- make the selftests work again (they were apparently not used since
  very early in bgen's development), with some minor cleanup by me
- make emacs python mode happier
2001-08-27 14:30:55 +00:00
Barry Warsaw e98e462dab Bump to version 1.3. Also document the new behavior of the chip widgets. 2001-08-23 16:15:21 +00:00
Barry Warsaw 924ea05e45 Bump to version 1.3 2001-08-23 16:15:02 +00:00
Barry Warsaw e47e97792a Implement some suggestions by Laura Creighton.
ChipWidget.__init__(): Added a message area just below the color
    name.  Both the message and name widgets are now FLAT, DISABLED
    Entry widgets instead of Labels.  This allows users to
    copy-n-paste the color names or color specs.  Also, the contents
    of both widgets are now driven by StringVars.

set_color(): This only sets the chip color; it does not set the name
    widgets.

set_name(): New method which only sets the name widget contents.

set_message(): New method which only sets the message widget contents.

ChipViewer.update_yourself(): Set the color, name, and message for
    each chip as follows: the first line always contains the color
    spec in #rrggbb format.  The second line will contain the color
    name, but slightly differently for each widget.  For the Selected
    widget, if the color exactly matches the Nearest color, the name
    is shown, otherwise the message field will be empty.  The name
    field of the Nearest widget will always contain the color name.
2001-08-23 16:14:45 +00:00
Jeremy Hylton 241d69c11b Add a little introductory text.
Change several sections to subsections (part of the manual -> howto
transformation).

Flesh out discussion of assignment nodes (and delete statements).

Add an example of manipulating AST objects at a >>> prompt
2001-08-18 00:24:46 +00:00
Jeremy Hylton ab427b8cce Generate correct reprs for Mul, Add, etc. 2001-08-18 00:14:37 +00:00
Jeremy Hylton ec5bfd13ca Track removal of doc string from Module().nodes[0] 2001-08-18 00:07:46 +00:00
Jeremy Hylton 8548f9b183 Add Yield() node 2001-08-18 00:07:14 +00:00
Jeremy Hylton ec927348c2 Add Yield() statement handler
Fix Module() handler to avoid including the doc string in the AST
2001-08-18 00:04:31 +00:00
Fred Drake 4e6a3fe0f6 Remove spurious space before a period. 2001-08-15 18:48:10 +00:00
Fred Drake 834a85a235 Use the "howto" document class rather than the "manual" class.
Remove the module index; there aren't enough modules documented yet
for this to make sense.

Add a couple more index entries, fixed a few typos, and adjusted a few
more things for consistency.
2001-08-15 17:01:34 +00:00
Fred Drake 27413a5eda Properly mark attribute names in the table. 2001-08-15 16:47:10 +00:00
Fred Drake 3d05161c83 Change the generated markup so that attribute names are properly marked. 2001-08-15 16:46:22 +00:00
Fred Drake 42caf3f6a3 Fix small markup consistency nits. 2001-08-15 14:35:13 +00:00
Tim Peters ebb7133f4f Fix typo in module docstring. 2001-08-15 06:07:42 +00:00
Jeremy Hylton f5bf77c3f8 update simple explanation of parseFile() 2001-08-14 22:38:03 +00:00
Jeremy Hylton 76f42ac512 First day's progress on documentation 2001-08-14 22:04:44 +00:00
Jeremy Hylton 9272b14d62 Fix typo in astgen script 2001-08-14 21:18:30 +00:00
Jeremy Hylton 7713ac2ff1 Regenerated from new ast.txt and new astgen.py 2001-08-14 18:59:01 +00:00
Jeremy Hylton eef65908a1 Add getChildNodes() method to Node 2001-08-14 18:58:00 +00:00
Jeremy Hylton 34aeeffb62 Add Yield node 2001-08-14 18:57:43 +00:00
Andrew M. Kuchling 392aa1de1d Update e-mail address 2001-08-13 15:10:54 +00:00
Tim Peters 3055ad234a + A msg on c.l.py reminded me that docstrings can be implicitly catenated.
Cater to that.
+ Major speed boost via not reading more of files than necessary.  This
  was no slouch before; now it screams.
+ Improve msg when giving up on a goofy future statement.
2001-08-13 05:33:53 +00:00
Tim Peters 5e824c37d3 SF patch #445412 extract ndiff functionality to difflib, from
David Goodger.
2001-08-12 22:25:01 +00:00
Tim Peters b704238a6c Tool to delete (or just rewrite parts of) obsolete future statements. 2001-08-12 08:41:13 +00:00
Guido van Rossum 38507ae614 Finally fix SF bug #441172, using a variant of patch ##443626:
canceling an edit operation would not revert the value of the field.
The fix takes care to destroy the Entry object, as suggested in the
patch.
2001-08-11 04:37:07 +00:00
Martin v. Löwis f2f8c51ae6 When representing #includes as imports, do from MOD import *. 2001-08-09 12:32:10 +00:00
Martin v. Löwis 4f85bf3311 Patch #437683: Use re instead of regex.
If multiple header files are processed simultaneously which include each
other, the corresponding modules mport each other. Specifically, if h2py
is invoked with sys/types.h first, later header files won't contain the
complete contents of TYPES.py.
2001-08-09 12:24:38 +00:00
Martin v. Löwis 6113d352a6 Patch #422471: Install IDLE Help File 2001-08-08 20:26:14 +00:00
Andrew M. Kuchling 564165e5c5 Added README to this directory 2001-08-08 19:10:11 +00:00
Guido van Rossum 44b1e7d840 Fix for SF bug #448835.
Fix this to work with the new (still undocumented) tabnanny API.

I'm afraid Stephen will have to add this fix to the IDLE fork code
base as well.
2001-08-07 17:15:36 +00:00
Andrew M. Kuchling 5dd064aac3 Tabify the file (pointed out by Thomas Wouters) 2001-08-06 19:33:52 +00:00
Andrew M. Kuchling ce2f4037ba Update listing of subdirectories
Update link to a running instance of the FAQwizard
2001-08-06 18:55:22 +00:00
Jack Jansen 1fbad002d7 Oops, this file was apparently never added to the repository. Now it is. 2001-08-06 10:08:56 +00:00
Tim Peters 45e5e72eb8 Rename pydoc.pyw to pydocgui.pyw: Since we changed Python to allow .pyw
files to satisfy imports, pydoc.pyw was just importing itself!
2001-08-05 05:43:20 +00:00
Barry Warsaw 63ce5af496 Added the -X/--no-docstrings flag which takes a filename containing a
list of files to not extract docstrings from when the -D option is
given.  This isn't optimal, but I didn't want to change the semantics
of -D, and it's bad form to allow optional switch arguments.

Bumping __version__ to 1.4.

TokenEater.__init__(): Initialize __curfile to None.

__waiting(): In order to extract docstrings from the module, both the
    -D flag should be set, and the __curfile should not be named in
    the -X filename (i.e. it isn't in opts.nodocstrings).

set_filename(): Fixed a bug where once the first module docstring is
    extracted, no subsequent module docstrings will be extracted.  The
    bug was that the first extraction set __freshmodule to 0, but that
    flag was never reset back to 1.  set_filename() is always called
    when the next file is being processed, so use it to reset the
    __freshmodule flag.

main(): Add support for -X/--no-docstring.
2001-07-27 16:47:18 +00:00
Fred Drake 79e75e1916 Use string.ascii_letters instead of string.letters (SF bug #226706). 2001-07-20 19:05:50 +00:00
Fred Drake cd694c44a9 Use string.ascii_letters instead of string.letters (SF bug #226706).
Move computation of sets of characters out of the body of the function that
uses them.
2001-07-20 18:58:42 +00:00
Jack Jansen 3d3a91c188 Oops, left in a debug statement. It's gone now. 2001-07-17 20:44:50 +00:00
Jack Jansen b2a1de4679 Allow [] after a parameter name. We currently take this to be the same as * in front, which isn't 100% correct but good enough. 2001-07-13 22:28:36 +00:00
Barry Warsaw 780028e14c Change the way hex type-ins are displayed. The old way was way too
fragile.  Now the leading "0x" on hex numbers are displayed as labels
and the type-in entry fields just accept the hex digits.  Be sure to
strip off the "0x" string when displaying hex values too.

Also, de-string-module-ification, and other Python 2.x improvements.
2001-07-10 21:50:44 +00:00
Barry Warsaw ffa926d77e __init__(), save_views(): Catch ValueError along with IOError and
EOFError so any failures in unmarshalling are just ignored.  Use
print>> instead of sys.stderr.write().
2001-07-10 21:48:51 +00:00
Barry Warsaw 698c14936a Update a comment. 2001-07-10 21:45:27 +00:00
Barry Warsaw 179048fc5d __init__(): Use augmented assignments. 2001-07-10 21:44:59 +00:00
Barry Warsaw 8e4fa072f7 De-string-module-ification. 2001-07-10 21:44:24 +00:00
Barry Warsaw 60e1886e87 __version__: Bump to 1.2
De-string-module-ification.
2001-07-10 21:42:04 +00:00
Barry Warsaw 95cf9d9f4e __populate(): Use augmented assignments. 2001-07-10 21:39:41 +00:00
Barry Warsaw b4d8612f2b __delta(): Use augmented assignments. 2001-07-10 21:39:18 +00:00
Barry Warsaw 6c50ae0801 De-string-module-ification and other Python 2.x improvements. 2001-07-10 21:38:47 +00:00
Barry Warsaw 2803046992 Update a comment. 2001-07-10 21:37:28 +00:00
Barry Warsaw 3e481de337 Updated documentation, and bump the version number to 1.2. 2001-07-10 21:37:04 +00:00
Guido van Rossum 4269601f5c Amazing. A very subtle change in policy in descr-branch actually
found a bug here.  Here's the deal:

Class PyShell derives from class OutputWindow.  Method PyShell.close()
wants to invoke its parent method, but because PyShell long ago was
inherited from class PyShellEditorWindow, it invokes
PyShelEditorWindow.close(self).  Now, class PyShellEditorWindow itself
derives from class OutputWindow, and inherits the close() method from
there without overriding it.  Under the old rules,
PyShellEditorWindow.close would return an unbound method restricted to
the class that defined the implementation of close(), which was
OutputWindow.close.  Under the new rules, the unbound method is
restricted to the class whose method was requested, that is
PyShellEditorWindow, and this was correctly trapped as an error.
2001-07-06 20:26:31 +00:00
Jack Jansen eefac35594 Added WeakLink...Generator classes (should have done that ages ago). These check the c-function pointer for being NULL before calling it and raise UnimplementedError if it is.
This allows system libs to be weak-linked, thereby allowing us to generate functions that are only available on some OS versions without getting a NULL dereference if the function isn't available.
2001-07-01 22:09:29 +00:00
Jack Jansen 1319abf745 Make basechain a class variable in stead of initializing it in __init__. That way it's more easily overridden. 2001-06-28 22:07:30 +00:00
Jack Jansen 4f0f1584fb Added a couple more types that Apple has taken a fancy to. 2001-06-27 21:58:40 +00:00
Jack Jansen ff1cc902fe Added a Parser_OSX class that can parse new-style (C-only) headers,
such as the Core Foundation ones.
2001-06-26 21:53:25 +00:00
Guido van Rossum 9966e2c663 This is a trivial command line utility to print MD5 checksums.
I published it on the web as http://www.python.org/2.1/md5sum.py
so I thought I might as well check it in.

Works with Python 1.5.2 and later.

Works like the Linux tool ``mdfsum file ...'' except it doesn't take
any options or read stdin.
2001-06-22 16:05:48 +00:00
Barry Warsaw 5c94ce58e7 write(): Karl Eichwalder points out that the #, flag comments should
be outputted just before the msgid lines.
2001-06-20 19:41:40 +00:00
Barry Warsaw 8c78d3a5d1 write(): It's been generally agreed on the i18n-sig that the docstring
marker should be output as a #, flag, e.g. "#, docstring".
2001-06-19 19:54:19 +00:00
Tim Peters 82ac8d13ff Taught IDLE's autoident parser that "yield" is a keyword that begins a
stmt.  Along w/ the preceding change to keyword.py, making all this work
w/ a future-stmt just looks harder and harder.
2001-06-19 00:28:47 +00:00
Guido van Rossum ac4797a12e Make copy, cut and paste events case insensitive. Reported by Patrick
K. O'Brien on idle-dev.

(Should other bindings follow suit?)
2001-06-12 00:30:33 +00:00
Tim Peters 2a7f384122 SF bug 430991: wrong co_lnotab
Armin Rigo pointed out that the way the line-# table got built didn't work
for lines generating more than 255 bytes of bytecode.  Fixed as he
suggested, plus corresponding changes to pyassem.py, plus added some
long overdue docs about this subtle table to compile.c.

Bugfix candidate (line numbers may be off in tracebacks under -O).
2001-06-09 09:26:21 +00:00
Martin v. Löwis a4debfffc9 Patch #430754: Makes ftpmirror.py .netrc aware 2001-06-07 17:17:00 +00:00
Guido van Rossum d993c87918 Quick update to the extension mechanism (extend.py is gone, long live
config.txt).

*** This is a bugfix-release candidate (for 2.1.1 and 2.0.1)! ***
2001-06-04 21:21:11 +00:00
Neil Schemenauer 89e90d67aa Separate CFLAGS and CPPFLAGS. CFLAGS should not contain preprocessor
directives, which is the role of CPPFLAGS.  Closes SF patch #414991.
2001-06-02 06:16:02 +00:00
Barry Warsaw 50cf706b5c write(): Aggressively sort all catalog entries, and fix the bug where
there were multiple translatable strings on a single line of source
code.
2001-05-24 23:06:13 +00:00
Barry Warsaw 128c77d03a write(): Do two levels of sorting: first sort the individual location
tuples by filename/lineno, then sort the catalog entries by their
location tuples.
2001-05-23 16:59:45 +00:00
Barry Warsaw 2b63969a5a main(): default-domain argument to getopt.getopt() was missing a = to
indicate it took an argument.  This closes SF patch #402223 by Bastian
Kleineidam.
2001-05-21 19:58:23 +00:00
Barry Warsaw 16b62c1300 __addentry(): add optional keyword arg `isdocstring' which is a flag
indicating whether the entry was extracted from a docstring or not.

write(): If any of the locations of a string appearance came from a
docstring, add a comment such as

#. docstring

before the references (after a suggestion by Martin von Loewis).
2001-05-21 19:51:26 +00:00
Barry Warsaw 6e972414be write(): A patch inspired by Tokio Kikuchi that sorts location entries
first by filename and then by line number.  Closes SF patch #425821.

Also, fixes a problem with duplicate entries.
2001-05-21 19:35:20 +00:00
Jack Jansen 656fe69383 Generate prototype-style function headers in stead of K&R style. Makes life easier with gcc -Wstrict-function-prototypes. 2001-05-19 13:59:18 +00:00
Marc-André Lemburg 716cf91839 Moved the encoding map building logic from the individual mapping
codec files to codecs.py and added logic so that multi mappings
in the decoding maps now result in mappings to None (undefined mapping)
in the encoding maps.
2001-05-16 09:41:45 +00:00
Guido van Rossum e9d7f0779d Refactored, with some future plans in mind.
This now uses the new gotofileline() method defined in FileList.py.
2001-05-12 12:30:04 +00:00
Guido van Rossum 6cb7a21934 Move the action of loading the configuration to the IdleConf module
rather than the idle.py script.  This has advantages and
disadvantages; the biggest advantage being that we can more easily
have an alternative main program.
2001-05-12 12:18:10 +00:00
Guido van Rossum 8451ebb435 Delete goodname() method, which is unused.
Add gotofileline(), a convenience method which I intend to use in a
variant.

Rename test() to _test().
2001-05-12 12:11:36 +00:00
Fred Drake a2133339ff Only catch NameError and TypeError when attempting to subclass an
exception (for compatibility with old versions of Python).
2001-05-11 19:40:10 +00:00
Jeremy Hylton 66a7e57c7e Fix several bugs and add two features.
Assertion error message had typos in arguments to string format.

.cover files for modules in packages are now put in the right place.

The code that generate .cover files seemed to prepend a "./" to many
absolute paths, causing them to fail.  The code now checks explicitly
for absolute paths and leaves them alone.

In trace/coverage code, recover from case where module has no __name__
attribute, when e.g. it is executed by PyRun_String().  In this case,
assign modulename to None and hope for the best.  There isn't anywhere
to write out coverage data for this code anyway.

Also, replace several sys.stderr.writes with print >> sys.stderr.

New features:

-C/--coverdir dir: Generate .cover files in specified directory
instead of in the directory where the .py file is.

-s: Print a short summary of files coverred (# lines, % coverage,
name)
2001-05-08 04:20:52 +00:00
Fred Drake 223ac0a498 Remove BrowserControl module; this had been left in for Python 1.5.2
support.
2001-04-18 18:43:34 +00:00
Fred Drake 6e06531d92 Remove legacy support for the BrowserControl module; the webbrowser
module has been included since Python 2.0, and that is the preferred
interface.
2001-04-18 18:42:48 +00:00
Barry Warsaw 2720d380e9 update_yourself(): Removed unused local variable reported by
PyChecker.
2001-04-18 03:53:29 +00:00
Barry Warsaw 31c2dae39c __init__(): Removed unused local variable reported by PyChecker. 2001-04-18 03:52:54 +00:00
Barry Warsaw 741eae0b31 StripWidget.__init__(), update_yourself(): Removed some unused local
variables reported by PyChecker.

__togglegentype(): PyChecker accurately reported that the variable
__gentypevar was unused -- actually this whole method is currently
unused so comment it out.
2001-04-18 03:51:55 +00:00
Barry Warsaw 6a5522677a Helpwin.__init__(): Removed an unused local variable (via import)
reported by PyChecker.
2001-04-18 03:50:07 +00:00
Barry Warsaw cc8a60cdf6 Bump the version to 1.1 2001-04-18 03:49:00 +00:00
Barry Warsaw 6330b52327 There have been a few new Python releases <wink> in the 2 years since
this tool was last touched!  Update some of the introductory material
and bump the version to 1.1.
2001-04-18 03:48:41 +00:00
Jeremy Hylton bb0bae6da2 Pop loop off the loop stack before handling the loop's else clause.
Otherwise, continue/break will attempt to affect the wrong loop.

A few more fiddles to get the SET_LINENOs consistent across compilers.
2001-04-12 21:54:41 +00:00
Jeremy Hylton 13d70944cb Use new _implicitNameOp() to generate name op code for list comprehensions.
Always emit a SET_LINENO 0 at the beginning of the module.  The
builtin compiler does this, and it's much easier to compare bytecode
generated by the two compilers if they both do.

Move the SET_LINENO inside the FOR_LOOP block for list
comprehensions.  Also for compat. with builtin compiler.
2001-04-12 21:04:43 +00:00
Jeremy Hylton 614e87f286 Add support for visitAssAttr to findOp(). 2001-04-12 20:24:26 +00:00
Jeremy Hylton 542b11acfd pyassem.py:
Fix annoying bugs in flow graph layout code.  In some cases the
    implicit control transfers weren't honored.  In other cases,
    JUMP_FORWARD instructions jumped backwards.

    Remove unused arg from nextBlock().

pycodegen.py

    Add optional force kwarg to set_lineno() that will emit a
    SET_LINENO even if it is the same as the previous lineno.

    Use explicit LOAD_FAST and STORE_FAST to access list comp implicit
    variables.  (The symbol table doesn't know about them.)
2001-04-12 20:21:39 +00:00
Jeremy Hylton bfb0cf822b Revise handling of tuple arguments so that the variables names match
those used by compile.c.  (test_grammar now depends on the names)
2001-04-12 17:33:34 +00:00
Jeremy Hylton 5c9aad6043 Only treat an AugAssign as def if its the target is a Name.
Fixes last bug found with test_scope.py.
2001-04-12 07:06:25 +00:00
Jeremy Hylton 3f76b7e6e4 Fix unpackSequence() to use _nameOp() rather than LOAD_FAST 2001-04-12 06:52:27 +00:00
Jeremy Hylton 660cc77abb Inside a class scope always use LOAD_NAME, STORE_NAME, DEL_NAME 2001-04-12 06:49:00 +00:00
Jeremy Hylton 364f9b9e2f Preliminary support for nested scopes
XXX Still doesn't work right for classes
XXX Still doesn't do sufficient error checking
2001-04-12 06:40:42 +00:00
Jeremy Hylton 53ee2a94c7 Define constants for types of scopes 2001-04-12 06:39:24 +00:00
Jeremy Hylton 84ec1f9159 typo 2001-04-11 16:43:13 +00:00
Jeremy Hylton 01d12937df [finishing fix from earlier checkins]
Call set_lineno() in visitDiscard(), which will generate linenos for
discard statements, e.g. the statement "1/0"

Fixes SF bug #409587
2001-04-11 16:36:25 +00:00
Jeremy Hylton d91bbba89d Add support for extra (*) arguments to preorder.
Change default dispatch to use extended call syntax in place of apply.
2001-04-11 16:26:05 +00:00
Jeremy Hylton 9ab019bee7 Generate docstrings.
Fixes SF buf #217004

Add method fixDocstring() to CodeGenerator.  It converts the Discard
node containing the docstring into an assignment to __doc__.
2001-04-11 16:24:30 +00:00
Jeremy Hylton 4c1f42733c Add lineno attributes to Discard nodes 2001-04-11 16:22:26 +00:00
Jeremy Hylton 5af105eec9 Make sure the docstring is always entered as the first element in the
consts, even if it is None.

Simplify _lookupName() by removing lots of redundant tests.
2001-04-11 16:21:51 +00:00
Guido van Rossum f9e56e117f Append the revision number for each file to the output.
(Yes, this is a new feature right before the 2.1 release.  No, I can't
imagine this would seriously break anybody's code.  In fact, most
users of this script are probably *happy* to see this addition.)
2001-04-10 03:31:27 +00:00
Jeremy Hylton dbdb28e8be Add globals to list of names returned by get_names().
Fix func arg processing to handle args in tuples.
In test code, skip names beginning with '.'.
2001-04-09 20:11:59 +00:00
Jeremy Hylton f870c952f9 Add two arguments to Scope constructor, module scope and class name
Add mangling support
Add get_children() and add_child() methods to Scope
Skip nodes when If test is a false constant
Add test code that checks results against symtable module
2001-04-09 13:57:32 +00:00
Jeremy Hylton 8b966dcf03 Add preliminary module symbol table constructor 2001-04-09 04:35:35 +00:00
Jeremy Hylton 80e29bd139 Add support for future statements 2001-04-09 04:28:48 +00:00
Jeremy Hylton 42a0830713 Fix "import as" (has always skipping the as name)
Fix com_NEWLINE() so that is accepts arguments, which occurs for lines like:
    stmt; # note trailing semicolon
Add XXX about checking for assignment to list comps
2001-04-09 04:27:12 +00:00
Jeremy Hylton a384f737cc typo 2001-04-09 04:23:55 +00:00
Fred Drake d34a9c98a9 Added more link attributes based on additonal information from Chris
McCafferty <christopher.mccafferty@csg.ch>, and a bit of experimentation
with Navigator 4.7.

HTML-as-deployed is evil!
2001-04-05 18:14:50 +00:00
Fred Drake f3186e8242 A number of improvements based on a discussion with Chris McCafferty
<christopher.mccafferty@csg.ch>:

Add javascript: and telnet: to the types of URLs we ignore.

Add support for several additional URL-valued attributes on the BODY,
FRAME, IFRAME, LINK, OBJECT, and SCRIPT elements.
2001-04-04 17:47:25 +00:00
Tim Peters 301ab7f2d0 Initialize new save_warnings_filters data member in ModifiedInterpreter.__init__.
Was getting mystery
    ModifiedInterpreter instance has no attribute 'save_warnings_filters'
errors at odd times (for sure in a fresh IDLE, fresh file, then Run Script).
2001-03-29 03:34:43 +00:00
Guido van Rossum b4ce43011e Turn SyntasWarning into SyntaxError for all code entered
interactively.
2001-03-26 17:41:35 +00:00
Ka-Ping Yee fde8a86a4e Script for starting pydoc with a GUI in Windows. 2001-03-23 14:10:39 +00:00
Guido van Rossum 53f5968f9b Make this IDLE version 0.8. (We have to skip 0.7 because that was a
CNRI release in a corner of the basement of a government building on a
planet circling Aldebaran.)
2001-03-22 17:37:52 +00:00
Guido van Rossum 3cc1250f16 Don't use __debug__ as if it were some module global. Use DEBUG
instead.
2001-03-22 17:27:13 +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
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
Eric S. Raymond 1bb515b0e5 Teach Tools/freeze/makeconfig.py and Tools/freeze/parsesetup.py to use
the re package rather than the obsolete regex.
2001-03-18 11:27:58 +00:00
Tim Peters 401396fc60 Get rid of hardcoded Python path (can't guess where the user installed
IDLE, and it likely changes across releases anyway).
2001-03-10 21:48:24 +00:00
Barry Warsaw 78d7dc4979 Added -o/--output-file option as per GNU msgfmt to specify the output
file instead of using inputfilename.mo
2001-03-02 16:53:54 +00:00
Martin v. Löwis 0f6b3832b9 Put current date into POT-Creation-Date; leave PO-Revision-Date for
for the translator to update; that is compatible with xgettext 0.10.35.
2001-03-01 22:56:17 +00:00
Ka-Ping Yee 895e8925d6 Call main routine in pydoc module (pydoc.cli). 2001-03-01 00:25:40 +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
Jack Jansen 8a69373664 Dialog and Window objects are (finally) different beasts. 2001-02-27 11:05:00 +00:00
Jack Jansen d67566b0f0 Use the filename, not the pathname, in the definitions file
comment. This way the generated files are identical when generated on
different machines.
2001-02-27 11:04:20 +00:00
Barry Warsaw 75ee8f54fa main(): Slightly more informative error message when TokenError
occurs.  Also, continue processing.
2001-02-26 04:46:53 +00:00
Tim Peters af449638b6 Patch 103928: Correct zlib freeze settings for Win32. 2001-02-23 03:45:13 +00:00
Fred Drake f5d2fdf164 Hack to make this still work with Python 1.5.2. ;-( 2001-02-16 22:13:48 +00:00
Tim Peters 9ae2148ada Moved SequenceMatcher from ndiff into new std library module difflib.py.
Guido told me to do this <wink>.
Greatly expanded docstrings, and fleshed out with examples.
New std test.
Added new get_close_matches() function for ESR.
Needs docs, but LaTeXification of the module docstring is all it needs.
\CVS: ----------------------------------------------------------------------
2001-02-10 08:00:53 +00:00
Tim Peters 670fa52698 Whitespace normalization. 2001-02-09 21:23:21 +00:00
Jeremy Hylton 1eab0028e6 move "from Tkinter import *" to module level 2001-02-02 20:07:46 +00:00
Barry Warsaw 1bbc048310 Special case around some of the nastier annoyances with the type-in
fields.  You can now backspace out the 0 in 0x0, and you can clear the
field when in decimal mode.  There are still some oddities about
typing into these fields, but it should be much less annoying.  The
real solution is to ditch the update-while-typing "feature".
2001-02-01 21:31:58 +00:00
Barry Warsaw 74a7ece9f3 Move the "from Tkinter import *" out of the method and into the module
scope (still inside the __name__=='__main__' guard).  Necessitated by
recent addition of nested scopes.
2001-02-01 20:52:08 +00:00
Martin v. Löwis 646ddec41f Allow installation of IDLE via distutils (patch #103138). 2001-01-28 11:01:50 +00:00
Tim Peters 19f52c2e34 Windows: ucnhash subproject no longer exists (/F merged into unicodedata). 2001-01-24 10:07:22 +00:00
Fredrik Lundh b2dfd73bdc Unicode nits: Don't include unicodedatabase.h no more. And make sure
to build *all* tables in makeunicodedata.py.
2001-01-21 23:31:52 +00:00
Fredrik Lundh 7b7dd107b3 compress unicode decomposition tables (this saves another 55k) 2001-01-21 22:41:08 +00:00
Fredrik Lundh 9e9bcda547 forgot to check in the new makeunicodedata.py script 2001-01-21 17:01:31 +00:00
Tim Peters d5d2cd149f Color all word instances of "as" after "import", & on the same line, as if
keywords.  Cheap approximation to the truth.
2001-01-19 10:41:49 +00:00
Guido van Rossum 9d593a526b This still mentioned IdlePrefs.py as the place to edit color
preferences.  It is now in config.txt or ~/.idle.
2001-01-19 03:30:58 +00:00
Tim Peters 79b334ba55 Hand repair of cases where reindent changed lines of the form
\t\t\t\t\treal code
##\t\t\t\t\tunused code
\t\t\t\t\treal code

via untabifying and shifting the real code left.  Semantically the
same but made the intent of the commented-out-in-column-0 unused code
unclear.  The exact same unused code appears to have gotten copied from
file to file over the years.
2001-01-17 09:13:33 +00:00
Tim Peters 70c4378dbc Whitespace normalization. 2001-01-17 08:48:39 +00:00
Guido van Rossum ecc463a617 New, improved README from Mike Clarkson. Wow! 2001-01-03 23:50:59 +00:00
Marc-André Lemburg a866df806d This patch changes the default behaviour of the builtin charmap
codec to not apply Latin-1 mappings for keys which are not found
in the mapping dictionaries, but instead treat them as undefined
mappings.

The patch was originally written by Martin v. Loewis with some
additional (cosmetic) changes and an updated test script
by Marc-Andre Lemburg.

The standard codecs were recreated from the most current files
available at the Unicode.org site using the Tools/scripts/gencodec.py
tool.

This patch closes the bugs #116285 and #119960.
2001-01-03 21:29:14 +00:00
Guido van Rossum ef92edd903 Make the test program work outside IDLE. 2001-01-02 21:22:03 +00:00
Guido van Rossum b19f1e3701 Add Alt-slash to Unix keydefs (I somehow need it on RH 6.2).
Get rid of assignment to unused self.text.wordlist.
2001-01-02 18:28:52 +00:00
Guido van Rossum 88b5ae0110 Fixed snake logo and minus image by Daniel Calvelo. 2000-12-27 22:26:08 +00:00
Jack Jansen 27489d4c8c Optionally weed out duplicate prototypes for the same function (which
happens because the scanner ignores preprocessor #ifs).
2000-12-12 22:24:35 +00:00
Jack Jansen c1a4a04792 Adapted to new standard for initmodule() routine: don't call
Py_FatalError on errors.
2000-12-12 22:22:59 +00:00
Jack Jansen 7e0c0050a8 Various new standard types. 2000-12-12 22:21:39 +00:00
Jack Jansen b8c68634b3 Added support for generating a single module from multiple .h files.
Allow /* */ comments within function prototypes.
2000-12-12 22:21:11 +00:00
Tim Peters 2f1aeb950d SF bug 124051: ndiff "?" lines can be confusing. Well, they still can, but
after implementing it I liked Gregor's two-"?" line idea a lot.
2000-12-09 05:03:22 +00:00
Jeremy Hylton 4ebf3be407 a few small optimizations that seem to give a 5-10% speedup; the
further optimization of com_node makes the most difference.
2000-11-06 16:03:52 +00:00
Jeremy Hylton eefaeb78b3 move pruneNext method to correct object (doh!) 2000-11-06 03:47:39 +00:00
Jeremy Hylton 314e3fb215 Change the graph structure to contain the code generator object for
embedded code objects (e.g. functions) rather than the generated code
object.  This change means that the compiler generates code for
everything at the end, rather then generating code for each function
as it finds it.  Implementation note: _convert_LOAD_CONST in
pyassem.py must be change to call getCode().

Other changes follow.  Several changes creates extra edges between
basic blocks to reflect control flow for loops and exceptions.  These
missing edges had gone unnoticed because they do not affect the
current compilation process.

pyassem.py:
    Add _enable_debug() and _disable_debug() methods that print
    instructions and blocks to stdout as they are generated.

    Add edges between blocks for instructions like SETUP_LOOP,
    FOR_LOOP, etc.

    Add pruneNext to get rid of bogus edges remaining after
    unconditional transfer ops (e.g. JUMP_FORWARD)

    Change repr of Block to omit block length.

pycodegen.py:
    Make sure a new block is started after FOR_LOOP, etc.

    Change assert implementation to use RAISE_VARARGS 1 when there is
    no user-specified failure output.

misc.py:
    Implement __contains__ and copy for Set.
2000-11-06 03:43:11 +00:00
Jeremy Hylton a59ac0a7df If a function contains a doc string, remove the doc string node from
the function's body.

If assert is used without an error message, make the AST node None
rather than Name('None').
2000-11-06 03:33:52 +00:00
Mark Hammond d3d7bb1c31 Application of [ Patch #102226 ] freeze/modulefinder.py should use _winreg, not win32api 2000-11-06 02:49:27 +00:00
Fredrik Lundh fad27aee11 Added 38,642 missing characters to the Unicode database (first-last
ranges) -- but thanks to the 2.0 compression scheme, this doesn't add
a single byte to the resulting binaries (!)

Closes bug #117524
2000-11-03 20:24:15 +00:00
Tim Peters 0d430e28c0 Hack ndiff to display lines w/ leading tabs more intuitively. This synchs
ndiff w/ a custom version I made for Guido during the pre-2.0 freeze.
2000-11-01 02:51:27 +00:00
Barry Warsaw 08a8a355be Added the -D/--docstrings option for extraction of unmarked module,
class, method, and function docstrings.
2000-10-27 04:56:28 +00:00
Fred Drake 9c6850510c Remove bogus stdout redirection and use of sys.__stdout__; use
augmented print statement instead.
2000-10-26 03:56:46 +00:00
Fred Drake 33e2c3ece3 Remove bogus stdout redirection and use of sys.__stdout__; use
augmented print statement instead.
2000-10-26 03:49:15 +00:00
Guido van Rossum e752baae71 Add IDLE wish: access items of arrays 2000-10-25 21:18:12 +00:00
Jeremy Hylton 7cff7fe21f Many changes.
Reformatting -- long lines, "[ ]" -> "[]", a few indentation nits.

Replace calls to Node function (which constructed ast nodes) with
calls to actual constructors imported from ast module.

Optimize com_node (most frequently used method) for the common case --
the appropriate method is found in _dispatch.

Fix com_augassign to use class object's rather than node names
(rendered invalid by recent changes to ast)

Remove expensive tests for sequence-ness in com_stmt and
com_append_stmt. These tests should never fail; if they do, something
is really broken and exception will be raised elsewhere.

Fix com_stmt and com_append_stmt to use isinstance rather than
testing's type slot of ast node (this slot disappeared with recent
changes to ast).
2000-10-25 18:10:32 +00:00
Jeremy Hylton 628d289d12 Generated from rev 1.1 of ast.txt 2000-10-25 18:02:59 +00:00
Jeremy Hylton 66d2c1f7e5 Small optimizations in dispatch method: 1) lookup node's __class__ once
and store in local; 2) define _preorder to be dispatch (rather than
method that called dispatch).
2000-10-25 18:02:02 +00:00
Jeremy Hylton 821eee3321 Support for generation of ast.py from simple description of node
structure (ast.txt).  Usage is python astgen.py > ast.py.
2000-10-25 17:59:17 +00:00
Jeremy Hylton ac148b5fcd run the std regression test suite using bytecode produced by the compiler 2000-10-13 22:00:13 +00:00
Jeremy Hylton e7f710cc06 add -d option that dumps entire AST before compiling 2000-10-13 21:59:32 +00:00
Jeremy Hylton 9c048f9f65 Now supports entire Python 2.0 language and still supports Python
1.5.2.  The compiler generates code for the version of the interpreter
it is run under.

ast.py:
    Print and Printnl add dest attr for extended print
    new node AugAssign for augmented assignments
    new nodes ListComp, ListCompFor, and ListCompIf for list
        comprehensions

pyassem.py:
    add work around for string-Unicode comparison raising UnicodeError
        on comparison of two objects in code object's const table

pycodegen.py:
    define VERSION, the Python major version number
    get magic number using imp.get_magic() instead of hard coding
    implement list comprehensions, extended print, and augmented
        assignment; augmented assignment uses Delegator classes (see
        doc string)
    fix import and tuple unpacking for 1.5.2

transformer.py:
    various changes to support new 2.0 grammar and old 1.5 grammar
    add debug_tree helper than converts and symbol and token numbers
    to their names
2000-10-13 21:58:13 +00:00
Jeremy Hylton 4e1be72e6b Fix SF bug #116263: support for from .. import *
transformer.py: return '*', None from com_import_as_name
pycodegen.py: special case for name == '*'
pyassem.py: fix stack counting for IMPORT_ opcodes
2000-10-12 20:23:23 +00:00
Jeremy Hylton b769e80056 read in a .pyc file and disassemble the code objects 2000-10-09 14:35:24 +00:00
Tim Peters f2fba87dcc Fix for next iteration of SF bug 115690 (Unicode headaches in IDLE). The
parsing functions in support of auto-indent weren't expecting Unicode
strings, but text.get() can now return them (although it remains muddy as
to exactly when or why that can happen).  Fixed that with a Big Hammer.
2000-10-06 23:09:00 +00:00
Guido van Rossum 70280b859e I'm moving redemo.py here from Demo/tkinter/guido, since it is
somewhat useful to learn regular expressions, and this way it'll be
installed on Windows.

This closes bug report 115609.
2000-10-06 17:37:12 +00:00
Tim Peters ad14720262 New tool for normalizing indentation of .py files. 2000-10-05 03:48:38 +00:00
Fredrik Lundh 375732cd41 - don't set the titlecase flag for uppercase letters (sorry, tim) 2000-09-25 23:03:34 +00:00
Fredrik Lundh 0f8fad4969 unicode database compression, step 3:
- added decimal digit and digit properties to the unidb tables
2000-09-25 21:01:56 +00:00
Fredrik Lundh e9133f7e2e unicode database compression, step 3:
- use unidb compression for the unicodectype module.  smaller,
  faster, and slightly more portable...

- also mention the unicode directory in Tools/README
2000-09-25 17:59:57 +00:00
Fredrik Lundh cfcea49218 unicode database compression, step 2:
- fixed attributions
- moved decomposition data to a separate table, in preparation
  for step 3 (which won't happen before 2.0 final, promise!)
- use relative paths in the generator script

I have a lot more stuff in the works for 2.1, but let's leave
that for another day...
2000-09-25 08:07:06 +00:00
Tim Peters 2101348830 Fiddled w/ /F's cool new splitbins function: documented it, generalized it
a bit, sped it a lot primarily by removing the unused assumption that None was
a legit bin entry (the function doesn't really need to assume that there's
anything special about 0), added an optional "trace" argument, and in __debug__
mode added exhaustive verification that the decomposition is both correct and
doesn't overstep any array bounds (which wasn't obvious to me from staring at the
generated C code -- now I feel safe!).  Did not commit a new unicodedata_db.h, as
the one produced by this version is identical to the one already checked in.
2000-09-25 07:13:41 +00:00
Fredrik Lundh f367cacb98 unicode database compression, step 1:
- use unidb compression for the unicodedata module.  on Windows,
  the new unidatabase module is 120k, down from nearly 600k.
2000-09-24 23:18:31 +00:00
Tim Peters f58a7aafea Implemented new os.startfile function, unique to Windows, exposing a
subset of Win32 ShellExecute's functionality.  Guido wants this because
IDLE's Help -> Docs function currently crashes his machine because of a
conflict between his version of Norton AntiVirus (6.10.20) and MS's
_popen.  Docs for startfile are being mailed to Fred (or just read the
docstring -- it tells the whole story).
Changed webbrowser.py to use os.startfile instead of os.popen on Windows.
Changed IDLE's EditorWindow.py to pass an absolute path for the docs
(hardcoding ShellExecute's "directory" arg to "." as used to be done let
IDLE work, but made the startfile command exceedingly obscure for other
uses -- the MS docs are terrible, of course, & still not sure I
understand it).
Note that Windows Python must link with shell32.lib now!  That's where
ShellExecute lives.
2000-09-22 10:05:54 +00:00
Jeremy Hylton 572bdce4b3 change 2-space indent to 4-space indent 2000-09-20 02:47:28 +00:00
Jeremy Hylton 9c36a41694 distutils setup script 2000-09-20 02:35:19 +00:00
Guido van Rossum bdd901714d Fix typo (newtabwith). 2000-09-20 00:17:39 +00:00
Guido van Rossum f8d071332a Temporary fix for Bug #114821.
The cause was that the replace code necessarily used a PCRE internal
function to to template expansion.

The fix changes the code to use an SRE internal if SRE is used, and a
PCRE internal if SRE is used; in a way that should work with 1.5.2.

The solution can be sped up tremendously under the assumption that the
choice between sre and pre is not changed during the execution of the
program; especially replace-all will be slow.

But I'll leave that to someone else.
2000-09-19 20:51:17 +00:00
Jeremy Hylton 0b7b4b8a22 satisfy the tabnanny 2000-09-18 01:46:01 +00:00
Barry Warsaw 64850efa39 Allow this script to act like a module by only calling main() if
__name__ == '__main__'.  Closes SF bug #110844.
2000-09-16 22:09:51 +00:00
Guido van Rossum 8999053326 Fix for bug #113693: with the changes to the IMPORT_FROM opcodes, this
crashed on an assert.
2000-09-15 16:37:42 +00:00
Guido van Rossum 3634112b40 Include the filename in the errror message for F5 without saving.
This closes bug #110660.
2000-09-15 15:45:57 +00:00
Fred Drake 10515b6483 main(): Move hackery of sys.argv until after the Tk instance has been
created.  This allows the application-specific Tkinter
         initialization to be executed if present.  Also pass an explicit
         className parameter to the Tk() constructor.

This closes SourceForge bug #110618.
2000-09-15 04:32:56 +00:00
Guido van Rossum fa6013cff0 Don't emit 8 lines of (c) information at startup -- use the same text
as main.c.
2000-09-05 13:51:14 +00:00
Guido van Rossum 8586991099 REMOVED all CWI, CNRI and BeOpen copyright markings.
This should match the situation in the 1.6b1 tree.
2000-09-01 23:29:29 +00:00
Jeremy Hylton 92f3972090 patch by Neil Schemenauer to improve (fix?) line number generation 2000-09-01 20:47:37 +00:00
Jeremy Hylton 2051608616 Update magic number.
Fix import support to work with import as variant of Python 2.0.  The
grammar for import changed, requiring changes in transformer and code
generator, even to handle compilation of imports with as.
2000-09-01 20:33:26 +00:00
Guido van Rossum 1688f378cb Rob Hooft, Moshe Zadka: converted to 4 space indents and re instead of regex. 2000-09-01 13:41:37 +00:00
Barry Warsaw 72dacb8026 Tool to generate binary GNU .mo file from .po template files. Written
by Martin v. Loewis, proofed by Barry Warsaw for coding standards,
typos, and to make command line options compatible with GNU msgfmt
where they overlap.

Closes patch #101295.
2000-09-01 08:10:08 +00:00
Thomas Wouters 46cc7c0f7b Bring Tools/compiler almost up to date. Specifically:
- fix tab space issues (SF patch #101167 by Neil Schemenauer)
- fix co_flags for classes to include CO_NEWLOCALS (SF patch #101145 by Neil)
- fix for merger of UNPACK_LIST and UNPACK_TUPLE into UNPACK_SEQUENCE,
  (SF patch #101168 by, well, Neil :)
- Adjust bytecode MAGIC to current bytecode.

TODO: teach compile.py about list comprehensions.
2000-08-12 20:32:46 +00:00
Jeremy Hylton 20b2ca9d19 add note about compiler directory
(is bgen still "still under development"?)
2000-08-04 17:03:58 +00:00
Jeremy Hylton 7daf04d9e0 replace most calls to emit 'SET_LINENO' will call to method set_lineno
based on bug report by Neil Schemenauer
2000-08-04 16:56:51 +00:00
Jeremy Hylton 8612f1c152 update my email address
fix com_call_function to cope with trailing comma in "f(a, b,)"
2000-08-04 16:54:54 +00:00
Jeremy Hylton da1ec468b1 Python code coverage tool by Skip Montanaro and Andrew Dalke 2000-08-03 19:26:21 +00:00
Greg Stein fd342bf453 add a bit more legal junk
(too lazy to paste in the whole BSD license tho; included by ref)
2000-08-03 17:39:13 +00:00
Andrew M. Kuchling 7e11170e85 Removed Tools/perfecthash, per python-dev discussion 2000-07-29 13:24:39 +00:00
Guido van Rossum efdf107fb7 Add the exceptions module to the 'never' list -- it is built in. 2000-07-28 10:34:48 +00:00
Jeremy Hylton 4d6381dfee Fix UCNs machine with >= 32bit longs
originally submitted by Bill Tutt

Note: This code is actually going to be replaced in 2.0 by /F's new
database.  Until then, this patch keeps the test suite working.
2000-07-26 03:56:06 +00:00
Jeremy Hylton ffe968b8fe This script demonstrates use of the visitor interface of the compiler
package.
2000-07-25 16:43:23 +00:00
Peter Schneider-Kamp 332c59c4ef change some occurence of python15.dll to python20.dll
closes patch #100956
2000-07-24 16:02:00 +00:00
Thomas Wouters 7889010731 Miscelaneous ANSIfications. I'm assuming here 'main' should take (int,
char**) and return an int even on PC platforms. If not, please fix
PC/utils/makesrc.c ;-P
2000-07-22 19:25:51 +00:00
Thomas Wouters 7e47402264 Spelling fixes supplied by Rob W. W. Hooft. All these are fixes in either
comments, docstrings or error messages. I fixed two minor things in
test_winreg.py ("didn't" -> "Didn't" and "Didnt" -> "Didn't").

There is a minor style issue involved: Guido seems to have preferred English
grammar (behaviour, honour) in a couple places. This patch changes that to
American, which is the more prominent style in the source. I prefer English
myself, so if English is preferred, I'd be happy to supply a patch myself ;)
2000-07-16 12:04:32 +00:00
Jack Jansen c8081e9bfa Modified the standard mac preamble so we include pymactoolbox.h in
stead of defining lots of function prototypes in each module.
2000-07-15 22:29:30 +00:00
Jack Jansen 629eee0636 ScannerPREUH3.initpatterns() should call Scanner.initpatterns() so the
new comment patterns get included.
2000-07-15 22:27:47 +00:00
Guido van Rossum f67c2383da Patch by Toby Dickenson, mentored by Mark Hammond, to support
automatically finding (most of) the standard PYD extensions, and to
remove the hardcoded Python version.
2000-07-13 15:45:17 +00:00
Peter Schneider-Kamp 7f589fddad add expandtabs command (-e)
change eliminate to delete (-d)
2000-07-11 16:43:16 +00:00
Fred Drake 3637799afe Update to use the new standard webbrowser module if available, otherwise
uses the BrowserControl module.

BrowserControl is not removed to allow IDLE to be distributed separately
and still be used with Python 1.5.2.
2000-07-09 19:10:19 +00:00
Tim Peters dbd9ba6a6c Nuke all remaining occurrences of Py_PROTO and Py_FPROTO. 2000-07-09 03:09:57 +00:00
Marc-André Lemburg bc30b11764 Fix to use Py_UCS4. By Bill Tutt. 2000-07-07 17:53:54 +00:00
Jack Jansen e3889da076 Make a distinction between shorts and unsigned shorts. 2000-07-06 15:17:52 +00:00
Guido van Rossum ffcc3813d8 Change copyright notice - 2nd try. 2000-06-30 23:58:06 +00:00
Guido van Rossum fd71b9e9d4 Change copyright notice. 2000-06-30 23:50:40 +00:00
Marc-André Lemburg a4657f736c Marc-Andre Lemburg <mal@lemburg.com>:
Fixed a quote bug. Thanks to Fredrik Lundh.
2000-06-30 10:30:35 +00:00
Marc-André Lemburg e3f257e681 Marc-Andre Lemburg <mal@lemburg.com>:
Include <> -> "". Removed some left over code at the end of the file.
Patch by Bill Tutt.
2000-06-30 09:56:00 +00:00
Marc-André Lemburg 90321ec314 Marc-Andre Lemburg <mal@lemburg.com>:
Include <> -> "". Patch by Bill Tutt.
2000-06-30 09:53:22 +00:00
Guido van Rossum a04ff0fb53 Running the program through itself reveals that one end tag was
mislabeled.

(Using -c and then -e rearranges some comments, so I won't check that
in -- but it's a good test anyway.

Note that pindent is not perfect -- e.g. it doesn't know about
triple-quoted strings!)
2000-06-28 22:55:20 +00:00
Guido van Rossum 59811b189d Peter Schneider-Kamp:
Problem:
A Python program can be completed and reformatted using
Tools/scripts/pindent.py. Unfortunately there is no option for removal
of the generated "# end"-tags.  Although a few Python commands or a
"grep -v '# end '" can do wonders here, there are two drawbacks:
- not everyone has grep/time to write a Python script
- it is not checked whether the "# end"-tags were used validly

Solution:
add extra option "-e" (eliminate) to pindent.py
2000-06-28 22:47:22 +00:00
Guido van Rossum b7c298f806 Jack Jansen: Support for conditional inclusion of methods and functions 2000-06-28 20:53:33 +00:00
Marc-André Lemburg 4e5302a27e Marc-Andre Lemburg <mal@lemburg.com>:
Perfect hash table generator. Outputs a Python extension module
which provides access to the hash table (which is stored in static
C data) using custom code.

This module can currently only generates code for the ucnhash
module, but can easily be adapted to produce perfect hash tables
for other tasks where fast lookup in large tables is needed.

By Bill Tutt.
2000-06-28 16:53:16 +00:00
Marc-André Lemburg c5bb9c21fe Marc-Andre Lemburg <mal@lemburg.com>:
Generator for the new ucnhash module (ucnhash.h|c). Uses perfect_hash.py
to create the ucnhash module.
2000-06-28 16:49:29 +00:00
Marc-André Lemburg 93c409a590 Marc-Andre Lemburg <mal@lemburg.com>:
Utility extension module needed by perfect_hash.py

By Bill Tutt.
2000-06-28 16:48:05 +00:00
Fred Drake 6cd948ebd8 Rename the "browser" module to "BrowserControl", since Guido did not
like the short, ambiguous name.
2000-05-10 17:28:42 +00:00
Fred Drake 8638ace511 EditorWindow.python_docs():
Instead of using Netscape through os.system(), use the new
        browser.open() function to load the documentation on the
        default browser.  On Windows, this will use the installed
        documentation if it exists, instead of hitting python.org.
2000-05-10 16:50:07 +00:00
Fred Drake 95a40001e6 Collection of classes and convenience functions to control external
Web browsers.
2000-05-10 16:47:27 +00:00
Fred Drake bd7b8b3310 Minor edit of leading comments: 'the the' --> 'the', quoted 'enable'
option name for clarity.
2000-05-09 14:28:03 +00:00
Guido van Rossum 4b1235cdac Toby Dickenson:
Fix for problem with freeze when both "-m" and "-s service" options
are used.

(Blessed by MarkH)
2000-05-06 03:18:08 +00:00
Jeremy Hylton be317e615e patches from Mark Hammond
Attached is a set of diffs for the .py compiler that adds support
for the new extended call syntax.

compiler/ast.py:
CallFunc node gets 2 new children to support extended call syntax -
"star_args" (for "*args") and "dstar_args" (for "**args")

compiler/pyassem.py
It appear that self.lnotab is supposed to be responsible for
tracking line numbers, but self.firstlineno was still hanging
around.  Removed self.firstlineno completely.  NOTE - I didnt
actually test that the generated code has the correct line numbers!!

Stack depth tracking appeared a little broken - the checks never
made it beyond the "self.patterns" check - thus, the custom methods
were never called!  Fixed this.

(XXX Jeremy notes: I think this code is still broken because it
doesn't track stack effects across block bounaries.)

Added support for the new extended call syntax opcodes for depth
calculations.

compiler/pycodegen.py

Added support for the new extended call syntax opcodes.

compiler/transformer.py

Added support for the new extended call syntax.
2000-05-02 22:32:59 +00:00
Jeremy Hylton 0a4f1ff64e patches from Mark Hammond
compile.py:
On Windows, use 'nul' instead of '/dev/null'.

test.py:
Use double-quotes for the command-line, as Windows doesnt recognise
singles.
2000-05-02 22:29:46 +00:00
Barry Warsaw 75a6e67e69 Added an unused Unicode string for testing. 2000-05-02 19:28:30 +00:00
Guido van Rossum ce33eb3ee8 Sjoerd Mullender:
Bad % formatting.
2000-05-02 13:49:13 +00:00
Guido van Rossum 6664bb87dc Sjoerd Mullender: cmp.py is obsolete... 2000-04-28 13:31:52 +00:00
Guido van Rossum f3335e193b Patch inspired by Just van Rossum: on the Mac, in savefilename(), make
the path to save a relative path by prefixing it with os.sep (':').
Also fix an indent inconsistency in the same function.
2000-04-25 21:13:24 +00:00
Guido van Rossum e56b4cf804 Jack Jansen: A few new types needed by new API calls. 2000-04-24 14:56:00 +00:00
Guido van Rossum e39a88fd58 Two more items. 2000-04-11 15:30:19 +00:00
Fred Drake d6904ea5a0 Use a better approach to locating IDLE's default configuration,
allowing it to be run from anywhere, including through a symlink to
the actual idle.py script.
2000-04-10 16:27:47 +00:00
Guido van Rossum fa9ef1864f Just in case someone wants to use this, let's fix the pathname. 2000-04-06 20:09:17 +00:00
Guido van Rossum 2b6004a07f New version 1.0.4. I'm sure someone mailed me these patches but I
can't remember who. :-)  Changes:

- Support for Windows NT (different locking behavior)
- Added a logging mechanism
2000-03-31 00:58:00 +00:00
Guido van Rossum 8daef3791e New version 1.0.4. I'm sure someone mailed me these patches but I
can't remember who. :-)  Changes:

- Owner name+email made generic instead of GvR
- Support for Windows NT (running from a .bat file)
- DOcument <HTML>...</HTML> tags
2000-03-31 00:55:54 +00:00