Jeremy Hylton [Thu, 17 Feb 2000 22:09:35 +0000 (22:09 +0000)]
the previous quick hack to fix def foo((x,y)) failed on some cases
(big surprise). new solution is a little less hackish.
Code gen adds a TupleArg instance in the argument slot. The tuple arg
includes a copy of the names that it is responsble for binding. The
PyAssembler uses this information to calculate the correct argcount.
all fix this wacky case: del (a, ((b,), c)), d
which is the same as: del a, b, c, d
(Can't wait for Guido to tell me why.)
solution uses findOp which walks a tree to find out whether it
contains OP_ASSIGN or OP_DELETE or ...
Guido van Rossum [Thu, 17 Feb 2000 17:12:39 +0000 (17:12 +0000)]
Patches by Piers Lauder.
Reasons for patches:
1st patch (15,21):
version change
2nd patch (66,72):
This is a patch I found in a Zope product release (quite by accident!).
It relaxes the conditions for matching a literal. I've looked over the
logic, and tested it, and it seems sensible.
3rd patch (117,123):
It appears the quoting matcher was too general, and that the IMAP4
protocol requires characters like ':' in commands to be unquoted.
(This is the patch already sent to Guido.)
4th patch (699,705):
Spelling correction in comment.
5th patch (753,761):
Another patch from the Zope product. It seems that some IMAP4 servers
produce unexpected responses in the middle of valid command/response
sequences. This patch ignores the unexpected responses in this
situation. (How I wish users would send me bug reports with examples!).
last 2 patches: (1015,1028) (1038,1044):
Minor improvements to test code.
Guido van Rossum [Thu, 17 Feb 2000 15:19:15 +0000 (15:19 +0000)]
Patch by Mark Hammond:
* Changes to a recent patch by Chris Tismer to errors.c. Chris' patch
always used FormatMessage() to get the error message passing the error code
from errno - but errno and FormatMessage use a different numbering scheme.
The main reason the patch looked OK was that ENOFILE==ERROR_FILE_NOT_FOUND -
but that is about the only shared error code :-). The MS CRT docs tell you
to use _sys_errlist()/_sys_nerr. My patch does also this, and adds a very
similar function specifically for win32 error codes.
Guido van Rossum [Wed, 16 Feb 2000 21:11:52 +0000 (21:11 +0000)]
Patch by Jim Ahlstrom to add crc32, a useful checksum function
(e.g. used for ZIP files).
The patch includes code that says:
+ Copyright (C) 1986 Gary S. Brown. You may use this program, or
+ code or tables extracted from it, as desired without restriction.
My interpretation (and Jim's) is that Gary S Brown has no claims under
copyright, patent or other rights or interests. Lawyers might disagree.
Jeremy Hylton [Wed, 16 Feb 2000 00:55:44 +0000 (00:55 +0000)]
support for arglists with implicit tuple unpacks
- added a number of support methods to generate code just before the
body
- hack protocol for communicating number of args to PyAssembler
fix TryExcept generation for case where exception handler has no body
fix visitAssAttr
add comment about incomplete visitAssName
stop using the ExampleASTVisitor
change script invocation to accept a list of .py files (e.g. Lib/*.py)
Guido van Rossum [Tue, 15 Feb 2000 14:51:46 +0000 (14:51 +0000)]
In response to one particular complaint on edu-sig, change some error
messages from "OverflowError: integer pow()" to "OverflowError:
integer exponentiation". (Not that this takes care of the complaint
in general that the error messages could be greatly improved. :-)
Jeremy Hylton [Fri, 11 Feb 2000 20:27:07 +0000 (20:27 +0000)]
add support for Lambda nodes
change resolution of local name ops (LOAD_FAST). i think it makes
sense now. if it is an argument or a local var name that it used, it
must be in varnames. if it is a local var name that is used, it must
also be in names
Greg Ward [Fri, 11 Feb 2000 02:52:39 +0000 (02:52 +0000)]
Ditched '_find_SET()', since it was a no-value-added wrapper around
'get_msvc_paths()'.
Renamed '_do_SET()' to 'set_path_env_var()', tweaked docstring, and
cosmetically tweaked code.
Stylistic changes to MSVCCompiler constructor (variable renaming
and type consistency).
Greg Ward [Fri, 11 Feb 2000 02:47:15 +0000 (02:47 +0000)]
Latest patch from Thomas Heller/Robin Becker:
* tweak my docstrings
* fix None returns to empty list
* reshuffle responsibilities between '_find_exe()', '_find_SET()', and
the MSVCCompiler constructor -- now the constructor worries about
fetching the version list and determining the most recent one
* added "/W3" compile option
Also, I added/tweaked some docstrings.
Barry Warsaw [Thu, 10 Feb 2000 20:26:45 +0000 (20:26 +0000)]
Document the API changes to the nntplib module (exceptions become
classes, NNTP.__init__() grows a new optional argument to set reader
mode on the server).
Barry Warsaw [Thu, 10 Feb 2000 20:25:53 +0000 (20:25 +0000)]
Added new exception classes:
NNTPError - derived from Exception, it's the base class for all
other exceptions in this module
NNTPReplyError - what used to be error_reply
NNTPTemporaryError - what used to be error_temp
NNTPPermanentError - what used to be error_perm
NNTPProtocolError - what used to be error_proto
NNTPDataError - what used to be error_data
All the old names are retained for backwards compatibility; they point
to the class that replaces them. Also, any code in this module that
raises an exception, now does so with the exception class.
NNTP.__init__(): Added a new optional argument `readermode', which is
a flag that defaults to false. When set to true, the "mode reader"
command is sent to the NNTP server before user authentication. Reader
mode is sometimes necessary if you are connecting to an NNTP server on
the local machine and intend to call reader-specific comamnds, such as
`group'. If you get unexpected NNTPPermanentErrors, you might need to
set readermode. Patch provided by Thomas Wouters (who include the
standard disclaimer on is patches@python.org submission), and inspired
by Jim Tittsler.
Greg Ward [Thu, 10 Feb 2000 02:15:52 +0000 (02:15 +0000)]
Patch from Thomas heller:
* don't need to mention python<ver>.lib -- it's done by a pragma
* add debug flags for compile and link, and use them
* fix 'link_shared_library()' to pass everything to 'link_shared_object()'
* change filename when shared object with debug info (ugh)
Jeremy Hylton [Thu, 10 Feb 2000 00:47:08 +0000 (00:47 +0000)]
add ExampleASTVisitor:
* prints out examples of nodes that are handled by visitor. simply a
development convenience
remove NestedCodeGenerator -- it was bogus after all
replace with generateFunctionCode, a method to call to generate code
for a function instead of a top-level module
fix impl of visitDiscard (most pop stack)
emit lineno for pass
handle the following new node types: Import, From, Getattr, Subscript,
Slice, AssAttr, AssTuple, Mod, Not, And, Or, List
LocalNameFinder: remove names declared as globals for locals
PythonVMCode: pass arg names to constructor, force varnames to contain
them all (even if they aren't referenced)
Greg Ward [Wed, 9 Feb 2000 02:18:39 +0000 (02:18 +0000)]
Added 'debug' flags to compile and link methods, and added dummy code for
someone who knows Windows/MSVC++ to come along and add the right flags.
Comment noting that 'link_static_lib()' signature is inconsistent with
the other compiler classes (uh-oh!)
Greg Ward [Wed, 9 Feb 2000 02:16:14 +0000 (02:16 +0000)]
Added 'debug' flag to compile and link method signatures.
Doc fix: several paragraphs under 'link_static_lib()' moved to
'link_shared_lib()', where they belong.
Jeremy Hylton [Tue, 8 Feb 2000 19:01:29 +0000 (19:01 +0000)]
now produces valid pyc files for a least a trivial subset of the
language.
CodeGenerator:
* modify to track stack depth
* add emit method that call's PythonVMCode's makeCodeObject
* thread filenames through in hackish way
* set flags for code objects for modules and functions
XXX the docs for the flags seem out of date and/or incomplete
PythonVMCode:
* add doc string describing the elements of a real code object
LineAddrTable:
* creates an lnotab (no quite correctly though)
Jeremy Hylton [Fri, 4 Feb 2000 19:37:35 +0000 (19:37 +0000)]
rapid evolution towards producing real .pyc files (even though I don't
handle most of the language syntax yet)
create NestedCodeGenerator used to generator the separate code object
that needs to be passed as an argument to MAKE_FUNCTION when a def
stmt is found (probably useful for class too)
change CodeGenerator.visitFunction to use the NestedCG
add CompiledModule class to handle creation of .pyc (pretty minimal
for now)
add makeCodeObject method to PythonVMCode that replaces symbolic names
with indexes into slots of the code code. the design of this
class will probably need to be revised.