Commit Graph

2311 Commits

Author SHA1 Message Date
Jeremy Hylton ae3d79208f no real change -- testing syncmail 2000-02-15 21:57:14 +00:00
Jeremy Hylton d603dee4a3 add line numbers to nodes in the except clause (when possible) 2000-02-15 21:30:48 +00:00
Jeremy Hylton ca1ad182f2 tidy up tryexcept and tryfinally nodes 2000-02-15 21:30:00 +00:00
Jeremy Hylton 9e1cd688b5 edit a doc string
(real intent is to test out rsync install)
2000-02-14 23:57:56 +00:00
Jeremy Hylton a46fb3841b get rid of spurious print 2000-02-14 21:54:57 +00:00
Jeremy Hylton 126960b744 looks like everything is working except for try/except (pystone
compiles correctly)
2000-02-14 21:33:10 +00:00
Jeremy Hylton 17988d2a17 LeftShift & RightShift: fix reprs, change attr names to left and right
(so they are common with other binary ops)
2000-02-14 21:32:42 +00:00
Fred Drake b217687a6c Fix the question marks next to the expansions of some of the
colorspace name abbreviations, based on email from Gerrit Holl
<gerrit.holl@pobox.com>.
2000-02-14 21:30:52 +00:00
Jeremy Hylton bf6267e6f8 rename several of the generic attribute names for nodes. new node attrs are:
Exec: expr, locals, globals
Dict: items
Assert: test, fail
2000-02-14 18:34:11 +00:00
Jeremy Hylton 42907790b6 (), [], and {} should not be represented as constant expressions, they
should be calls to BUILD_ ops for these types with no arguments
2000-02-14 18:32:46 +00:00
Jeremy Hylton a50581228e split compile.py into two files
add StackDepthFinder (and remove push/pop from CodeGen)
add several nodes, including Ellipsis, Bit&|^, Exec
2000-02-14 14:14:29 +00:00
Jeremy Hylton 3050d51571 change MODULE_NAMESPACE/FUNCTION_NAMESPACE stuff to have a single flag
named OPTIMIZED, which matches compile.c and makes more sense for
classes

revamp call signature for PythonVMCode.__init__; doesn't really matter
'cuz this code is going to be refactored out of existence

add generateClassCode and modify Func & Lambda generation

add support for nodes Classdef, Keyword,

fix CallFunc to generate right op arg when calling w/ keywords

add ugly hack to properly compute offsets when the same stack ref is
used multiple times
2000-02-12 00:12:38 +00:00
Jeremy Hylton 76d01b820c 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
2000-02-11 20:27:07 +00:00
Greg Ward 5de8cee73f 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).
2000-02-11 02:52:39 +00:00
Greg Ward 699880931e 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.
2000-02-11 02:47:15 +00:00
Jeremy Hylton 4eb504c2af add loop handling via
Loop object to handle StackRegs
loops stack attr on CodeGenreeator to hold the current loop object

add support for nodes While, Break, Continue
2000-02-10 20:55:50 +00:00
Jeremy Hylton 95b8614353 add an __len__ to Set and Stack 2000-02-10 20:54:27 +00:00
Barry Warsaw 9dd7872945 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.
2000-02-10 20:25:53 +00:00
Jeremy Hylton 3e0910c10c add namespace attr to CodeGenerator, can be either MODULE_NAMESPACE or
FUNCTION_NAMESPACE.  initialize in __init__ and reset in
generateFunctionCode.

replace direct issue of STORE_FAST, STORE_GLOBAL, etc. with call to
storeName; same for loadName and deleteName

the new {store,load,delete}Name methods use the namespace attr and the
local variable stack to determine the correct bytecode to issue
2000-02-10 17:20:39 +00:00
Fred Drake 13a2c279c5 Untabify to pass the -tt test. 2000-02-10 17:17:14 +00:00
Fred Drake 857c4c36b9 Detabify.
I ran "expand" instead of using Skip's patch, but it's all the same.
2000-02-10 16:21:11 +00:00
Fred Drake ad892dc80d Make this pass the -tt test. 2000-02-10 15:31:07 +00:00
Greg Ward 62e3393e4d Stylistic changes to the registry-grovelling code: code formatting, changed
function names, dbetter (hopefully) ocstrings, and comments.
2000-02-10 02:52:42 +00:00
Greg Ward 10ca82b57c Typecheck 'output_dir' argument to compile/link methods. 2000-02-10 02:51:32 +00:00
Greg Ward 968d883be5 Path from Thomas Heller: resurrect the .def file kludge while preserving the
/export option mini-kludge.
2000-02-10 02:17:06 +00:00
Greg Ward 4ba9b2e3b6 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)
2000-02-10 02:15:52 +00:00
Jeremy Hylton 5e0ce53e0e 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)

add -q option on command line to disable stdout
2000-02-10 00:47:08 +00:00
Jeremy Hylton 69926eaee0 add remove method to set 2000-02-10 00:43:22 +00:00
Greg Ward e8c6ce4684 Added 'debug' option, and changed compile/link calls to use it. 2000-02-09 02:20:14 +00:00
Greg Ward 324620015d Added 'debug' option (just there for 'build_ext' and 'build_lib' commands
to fallback to if the user doesn't set it for those commands.
2000-02-09 02:19:49 +00:00
Greg Ward 386b84439f 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!)
2000-02-09 02:18:39 +00:00
Greg Ward ba233fbe92 Added 'debug' flags to compile and link methods, and modified code to add
'-g' flag to compiler/linker command lines when it's true.
2000-02-09 02:17:00 +00:00
Greg Ward 3c045a5766 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.
2000-02-09 02:16:14 +00:00
Jeremy Hylton 402456020b add optional verbose arg to walk function. it overrides the global
VERBOSE setting for the ASTVisitor

add getopt handling for one or more -v args

rename ForwardRef to StackRef, because it isn't necessarily directional

CodeGenerator:
* add assertStackEmpty method.  prints warning if stack is not empty
  when it should be
* define methods for AssName, UNARY_*, For

PythonVMCode:
* fix mix up between hasjrel and hasjabs for address calculation
2000-02-08 21:15:48 +00:00
Jeremy Hylton 156a975476 make all unary operators have a single child node called expr 2000-02-08 21:06:19 +00:00
Jeremy Hylton 1851901a05 add spaces to comparison names is not and not in to match dis 2000-02-08 19:58:33 +00:00
Jeremy Hylton 53187f32eb 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)
2000-02-08 19:01:29 +00:00
Jeremy Hylton aa9d2d6123 constants from transformer 2000-02-08 18:57:51 +00:00
Jeremy Hylton 9605c11c4c move constants out of transformer so that they can be shared with ast
add varargs and kwargs attributes to Function nodes
2000-02-08 18:57:32 +00:00
Fred Drake 69e2c6efbb get_config_h_filename(): Support NT as well as Posix systems.
_init_nt():  Use get_config_h_filename() instead of figuring out the
             name directly.

             g['SO'] should be set to '.pyd'.

             Adjust some minor coding nits.
2000-02-08 15:55:42 +00:00
Greg Ward 1b9c6f7788 Revised version (thank to Thomas Heller and Robin Becker) that tries a lot
harder to find the MSVC compiler (mainly by using the registry).
2000-02-08 02:39:44 +00:00
Greg Ward f0219ba290 Ditch .def file kludge for (much smaller) /export option kludge. 2000-02-08 02:37:15 +00:00
Fred Drake a710d6e20c Added test case for accessing gsbm database by key after it's closed;
it should raise gdbm.error.
2000-02-07 17:15:48 +00:00
Greg Ward 1bea7ab7bd Added 'libraries' option for use by the 'build_lib' command.
Typo fix.
2000-02-05 02:24:52 +00:00
Greg Ward 5f7c18e816 Run the 'build_lib' command before building extensions, if necessary. 2000-02-05 02:24:16 +00:00
Greg Ward aaf27ee07b New command to build C (and C++, hopefully) libraries needed by extensions
in the current distribution: motivated by PIL's libImaging.
2000-02-05 02:23:59 +00:00
Greg Ward c1854673e2 Tweaked various comments, docstrings, and error messages. 2000-02-05 02:23:16 +00:00
Jeremy Hylton 0fdffcf916 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.
2000-02-04 19:37:35 +00:00
Guido van Rossum 1fdae12c93 Added a simple test program to disassemble a file, invoked as __main__. 2000-02-04 17:47:55 +00:00
Guido van Rossum 4b8c6eaf8b Actually, the previous batch's comment should have been different;
*this* set of patches is Ka-Ping's final sweep:

The attached patches update the standard library so that all modules
have docstrings beginning with one-line summaries.

A new docstring was added to formatter.  The docstring for os.py
was updated to mention nt, os2, ce in addition to posix, dos, mac.
2000-02-04 15:39:30 +00:00
Guido van Rossum e7b146fb3b The third and final doc-string sweep by Ka-Ping Yee.
The attached patches update the standard library so that all modules
have docstrings beginning with one-line summaries.

A new docstring was added to formatter.  The docstring for os.py
was updated to mention nt, os2, ce in addition to posix, dos, mac.
2000-02-04 15:28:42 +00:00
Guido van Rossum 54f22ed30b More trivial comment -> docstring transformations by Ka-Ping Yee,
who writes:

Here is batch 2, as a big collection of CVS context diffs.
Along with moving comments into docstrings, i've added a
couple of missing docstrings and attempted to make sure more
module docstrings begin with a one-line summary.

I did not add docstrings to the methods in profile.py for
fear of upsetting any careful optimizations there, though
i did move class documentation into class docstrings.

The convention i'm using is to leave credits/version/copyright
type of stuff in # comments, and move the rest of the descriptive
stuff about module usage into module docstrings.  Hope this is
okay.
2000-02-04 15:10:34 +00:00
Jeremy Hylton 8b6323d3ef checking in initial weekend's work
compile.py: ASTVisitor framework plus bits of a code generator that
    should be bug-for-buf compatible with compile.c

misc.py: Set and Stack helpers

test.py: a bit of simple sample code that compile.py will work on
2000-02-04 00:28:21 +00:00
Jeremy Hylton 106a02da94 make p2c a package 2000-02-04 00:25:34 +00:00
Jeremy Hylton f968e8545d three files from the p2c cvs tree. the message here indicates the
revision number the p2c cvs tree.

COPYRIGHT: 1.1
ast.py: 1.3
transformer.py: 1.11
2000-02-04 00:25:23 +00:00
Greg Ward 7f0fb0b01e Improved an error message.
Announce when we start building each extension (better feedback).
2000-02-03 23:07:54 +00:00
Greg Ward ef6f515d49 Changed 'compile()' method to compile files one-at-a-time -- gives better
feedback and, theoretically, the opportunity to set compiler flags
on a per-file basis.
2000-02-03 23:07:19 +00:00
Fred Drake d89ffebd85 These modules are now declared obsolete. 2000-02-03 15:26:16 +00:00
Guido van Rossum 43265beff9 # module filecmp
# combo of old cmp, cmpcache and dircmp with redundancies removed
#
# bugs fixed:
#   dircmp.dircmp was not ignoring IGNORES
#   old stuff could falsely report files as "identical" when contents actually differed
#
# enhancements:
#   dircmp has a more straightforward interface
#cmp enhanced by Moshe Zadca
#dircmp enhanced byGordon McMillan

[some layout changes by GvR]
2000-02-03 00:41:22 +00:00
Guido van Rossum 75a7959335 In _fileobject, optimize read() a bit (it could be really slow), and
remove "import string" -- use string methods instead!
2000-02-02 16:57:32 +00:00
Guido van Rossum 823e91c767 Optimize abspath() slightly for the case that win32api can't be
imported; in that case, abspath is replaced by a fallback version.
2000-02-02 16:54:39 +00:00
Guido van Rossum 5606801b64 Make read() and readlines() conform more to the file object interface:
the default arg for read() is -1, not None, and readlines() has an
optional argument (which for now is ignored).
2000-02-02 16:51:06 +00:00
Guido van Rossum 4acc25bd39 Mass patch by Ka-Ping Yee:
1. Comments at the beginning of the module, before
       functions, and before classes have been turned
       into docstrings.

    2. Tabs are normalized to four spaces.

Also, removed the "remove" function from dircmp.py, which reimplements
list.remove() (it must have been very old).
2000-02-02 15:10:15 +00:00
Greg Ward 113e70efa2 Patch from Joe Van Andel: fix arg to % operator in warning. 2000-02-02 00:07:14 +00:00
Greg Ward a0ca3f24f9 Comment fix.
Always use normalized (with os.path.normpath()) versions of prefix and
  exec_prefix.
2000-02-02 00:05:14 +00:00
Guido van Rossum 3c8baedaf8 Sjoerd Mullender writes:
Fixed a TypeError: not enough arguments; expected 4, got 3.
When authentication is needed, the default http_error_401 method calls
retry_http_basic_auth.  The default version of that method expected a
data argument which wasn't provided, so now we provide the argument if
it was given and we also made the data argument optional.

Also changed other calls where data was optional to not pass data if
it was not passed to the calling method (in line with other similar
occurances).
2000-02-01 23:36:55 +00:00
Greg Ward d1466b968f Allow either README or README.txt as a "standard file". 2000-01-30 20:22:27 +00:00
Greg Ward a002edc85b Fixed broken list extend in 'copy_tree()'. 2000-01-30 19:57:48 +00:00
Greg Ward 37bc815053 Added 'description' class attribute to every command class (to help the
'--help-commands' option).
Shuffled imports around in a few command modules to avoid expensive
  up-front import of sysconfig (and resulting delays in generating list
  of all commands).
2000-01-30 18:34:15 +00:00
Greg Ward 4c67936e4e Added 'dist' command. 2000-01-30 18:31:34 +00:00
Greg Ward f0fd6175b3 Improvements to the help system:
* "--help" can now come either before or after particular commands
    to get help on and can give help on multiple commands, eg.
    "--help install dist" gives help on those two commands
  * added "--help-commands" option, implemented by the 'print_commands()'
    and 'print_command_list()' methods
2000-01-30 18:30:32 +00:00
Greg Ward 7478a4832a Added missing run of corresponding 'build' command. 2000-01-30 15:07:56 +00:00
Jeremy Hylton 6d7e47b8ea EXPERIMENTAL
An extensible library for opening URLs using a variety protocols.
Intended as a replacement for urllib.
2000-01-20 18:19:08 +00:00
Guido van Rossum 331f19e894 Change two occurrences of type(x) <> types.CodeType into
isinstance(x, types.CodeType).

Suggested by Finn Bock.
2000-01-19 21:57:30 +00:00
Greg Ward 9f200cbaa6 Fix indentation bug. 2000-01-17 21:58:07 +00:00
Greg Ward 3b49c9babd Catch OSError from 'spawnv()' in '_spawn_nt()'.
Tweaked error messages in '_spawn_posix()'.
2000-01-17 21:57:55 +00:00
Greg Ward 01f5215828 Removed /GD switch -- currently ignored by MSVC. 2000-01-17 21:57:17 +00:00
Greg Ward 8dbf681a97 Added compiler flags suggested by Thomas Heller: optimize, use multi-threaded
RT library.
2000-01-17 20:40:48 +00:00
Greg Ward 1b3a9af5cf Added missing import.
Fixed 'make_release_tree()' to copy files if 'os.link()' doesn't exist.
2000-01-17 20:23:34 +00:00
Greg Ward cbeca7b408 Added code to use Jim Ahlstrom's zipfile.py module if the external zip
command wasn't found or failed.  (Code supplied by Thomas Heller
<thomas.heller@ion-tof.com>.)
2000-01-17 18:04:04 +00:00
Greg Ward c8a95c8d5e Fix library filename methods -- there is no 'lib' prefix under DOS/Windows. 2000-01-17 18:00:04 +00:00
Greg Ward c27d800251 Always run sys.prefix and sys.exec_prefix through 'os.path.normpath()'
before storing or using.
2000-01-17 16:25:59 +00:00
Greg Ward 7c463ef362 Ditch unneeded imports. 2000-01-17 16:25:17 +00:00
Guido van Rossum 1d2b23ef22 Fix by Nick Russo in processing of timezone in test program; the
ParsedDate didn't have the correct day of week.
2000-01-17 14:11:04 +00:00
Greg Ward 7b7679eb79 'newer_group()' can now deal with missing files, in a way specified by
the 'missing' parameter.
2000-01-09 22:48:59 +00:00
Greg Ward c9f3187be2 Abstracted '_fix_link_args()' out of 'link_shared_object()'.
Added 'link_static_lib()' method, and 'archiver' and 'archiver_options'
  class attributes to support it.
Added 'link_executable()' method, and 'ld_exec' instance attribute
  to support it.
'newer_group()' is now able to handle missing files, so we don't have
  to kludge it by catching OSError when calling it.
'object_filenames()' and 'shared_object_filename()' now take 'keep_dir'
  flag parameters.
'library_filename()' and 'shared_library_filename()' now respect
  a directory component in the library name.
Various comment updates/deletions.
2000-01-09 22:47:53 +00:00
Greg Ward 5baf1c2111 Removed a bunch of irrelevant parameters from 'link_static_lib()' signature.
Added 'link_executable()' signature.
2000-01-09 22:41:02 +00:00
Greg Ward e9436da686 Typo fix: 'file.warn' should have been 'manifest.warn' in a couple of places. 2000-01-09 22:39:32 +00:00
Guido van Rossum d2783da63e The correct RFC to reference is RFC-1521 (MIME part one), not 1421 (PEM). 2000-01-03 15:44:40 +00:00
Greg Stein f23aa1ee9f redesign/rebuild around the ImportManager concept. 2000-01-03 02:38:29 +00:00
Fred Drake db1bd5c230 Revise tests to support str(<long int object>) not appending "L". 1999-12-23 15:36:42 +00:00
Fred Drake fbff97a73b Don't call len() if the value is already cached! Caught by Gerrit
Holl <gerrit.holl@pobox.com>.
1999-12-22 21:52:32 +00:00
Guido van Rossum 80c33e562d Contribution from Gerrit Holl:
This patch changes the string-based exceptions to class-based
exceptions, so that you can fetch the unknown option as an
attribute.  As far as I know, it is backward compatible.

[The new exception class is called GetoptError; the name error is an
alias for compatibility.]
1999-12-21 22:38:40 +00:00
Greg Ward 9d46b9ce97 When emitting a command-line error message, *say* it's an error. 1999-12-16 01:19:05 +00:00
Greg Ward ad83f04086 Catch errors from 'rmtree' and emit a warning. 1999-12-16 01:14:15 +00:00
Guido van Rossum cd97576184 Only set msg.fp to None when there are no extra arguments; if there
are, we must keep the file around so we can print the body.
1999-12-14 22:18:37 +00:00
Guido van Rossum 8c0622114b V 2.16 from Piers:
I've changed the login command to force proper
	quoting of the password argument. I've also added
	some extra debugging code, which is removed when
	__debug__ is false.
1999-12-13 23:27:45 +00:00
Greg Ward 97798b1d47 Use 'search', not 'match', on filename pattern regexes. 1999-12-13 21:38:57 +00:00
Greg Ward 0bdd90a7e7 Catch up with terminology change in UnixCCompiler: 'includes' -> 'include_dirs'. 1999-12-12 17:19:58 +00:00
Greg Ward 1d0495e05c Catch missing MANIFEST file and warn rather than blowing up.
Added 'nuke_release_tree()' method to blow away the directory from
  which the archive file(s) are created, and call it (conditionally)
  from 'make_distribution()'.
Added 'keep_tree' option (false by default) to disable the call to
  'nuke_release_tree()'.
1999-12-12 17:07:22 +00:00