Barry Warsaw [Fri, 23 Mar 2001 20:24:07 +0000 (20:24 +0000)]
main(): Application of SF patch #405851, which allows this test to be
used by Jython. The tests in this module expect C locale, so be
explicit about setting that (for CPython). However, in Jython, there
is no C locale, so instead be explicit about setting the US locale.
Closes the patch.
Guido van Rossum [Fri, 23 Mar 2001 17:54:43 +0000 (17:54 +0000)]
Finishing touch to Ping's changes. This is a patch that Ping sent me
but apparently he had to go to school, so I am checking it in for him.
This makes PyRun_HandleSystemExit() a static instead, called
handle_system_exit(), and let it use the current exception rather than
passing in an exception. This slightly simplifies the code.
Barry Warsaw [Fri, 23 Mar 2001 17:53:49 +0000 (17:53 +0000)]
Two minor changes for better Jython compatibility. Finn Bock says:
Change 1: Not all 'modules' in sys.modules have a
sensible __file__ attribute. Some of our java package
can have the __file__ attribute set to None.
Change 2: In jython we have the jython license file in
<root> and the CPython license file in <root>/Lib. By
reversing the search sequence jython will find and
show the jython license file before the CPython file.
Change rfc822_escape() to ensure there's a consistent amount of whitespace
after each newline, instead of just blindly inserting a space at
the start of each line. (Improvement suggested by Thomas Wouters)
Fred Drake [Fri, 23 Mar 2001 16:42:08 +0000 (16:42 +0000)]
Re-write to no longer depend on an old version of PyXML. This now
implements a SAX XMLReader interface instead of the old Builder interface
used with PyDOM (now obsolete).
This only depends on the standard library, not PyXML.
Barry Warsaw [Fri, 23 Mar 2001 16:13:30 +0000 (16:13 +0000)]
Several changes for Jython portability. This closes SF patch
#403666. Specifically,
In codestr, force `c' to be global. It's unclear what the semantics
should be for a code object compiled at module scope, but bound and
run in a function. In CPython, `c' is global (by accident?) while in
Jython, `c' is local. The intent of the test clearly is to make `c'
global, so let's be explicit about it.
Jython also does not have a __builtins__ name in the module's
namespace, so we use a more portable alternative (though I'm not sure
why the test requires "__builtins__" in the g namespace).
Finally, skip the new.code() test if the new module doesn't have a
`code' attribute. Jython will never have this.
Ka-Ping Yee [Fri, 23 Mar 2001 13:17:50 +0000 (13:17 +0000)]
Show inherited methods, with hyperlinks to the base class they came from.
Font adjustment to improve viewing in Windows (the default monospaced font,
Courier New, seems to have no reasonable size in IE!)
Improve error handling. Try very hard to distinguish between failure to
find a module and failure during the module importing process.
Improve reloading behaviour. (Still needs some work.)
Add '.' to sys.path when running as a script at the command-line.
Don't automatically assume '-g' based on the platform. We'll just have
the batch file supply -g.
Fred Drake [Fri, 23 Mar 2001 04:39:24 +0000 (04:39 +0000)]
When creating an attribute node using createAttribute() or
createAttributeNS(), use the parallel setAttributeNode() or
setAttributeNodeNS() to add the node to the document -- do not assume
that setAttributeNode() will operate properly for both.
Guido van Rossum [Fri, 23 Mar 2001 04:01:07 +0000 (04:01 +0000)]
Fix memory leak with SyntaxError. (The DECREF was originally hidden
inside a piece of code that was deemed reduntant; the DECREF was
unfortunately *not* redundant!)
Ka-Ping Yee [Fri, 23 Mar 2001 02:46:52 +0000 (02:46 +0000)]
Add sys.excepthook.
Update docstring and library reference section on 'sys' module.
New API PyErr_Display, just for displaying errors, called by excepthook.
Uncaught exceptions now call sys.excepthook; if that fails, we fall back
to calling PyErr_Display directly.
Also comes with sys.__excepthook__ and sys.__displayhook__.
Ka-Ping Yee [Fri, 23 Mar 2001 00:12:53 +0000 (00:12 +0000)]
Fixes for various issues reported and discovered since Python 9:
Factor description of import errors into DocImportError.__str__.
Add "docother" and "fail" methods to Doc class.
Factor formatting of constants into "docother".
Increase max string repr limit to 100 characters.
Factor page generation into HTMLDoc.page.
Handle aliasing of names (objects appearing under an attribute
name different from their intrinsic __name__) by passing the
attribute name into each doc* method.
Handle methods at top level of modules (e.g. in random).
Try to do reloading efficiently.
Important fixes still to do:
Module reloading is broken by the unfortunate property that
failed imports leave an incomplete module in sys. Still
need to think of a good solution.
Can't document modules in the current directory, due to the
other unfortunate property that sys.path gets '.' when
you run 'python' but it gets the script directory when
you run a script. Need to ponder to find a solution.
The synopsis() routine does not work on .so modules.
Aliases cause duplicate copies of documentation to appear.
This is easy to fix, just more work.
Classes appear as their intrinsic name, not their attribute name,
in the class hierarchy. This should be fixed.
Inherited methods should be listed in class descriptions.
Guido van Rossum [Thu, 22 Mar 2001 21:59:20 +0000 (21:59 +0000)]
This is SF patch #405952, by Anthony Baxter:
cmd.py uses raw_input(); eats SIGCLD:
I discovered a rather nasty side effect of the standard cmd.py
library today. If it's sitting inside raw_input(), any SIGCLDs that
get sent to your application get silently eaten and ignored. I'm
assuming that this is something that readline is thoughtfully doing
for me.
This patch adds an instance attr that allows the user to select to
not use raw_input(), but instead use sys.stdin.readline()
[Changed slightly to catch EOFError only for raw_input().]
Fred Drake [Thu, 22 Mar 2001 18:26:47 +0000 (18:26 +0000)]
A small change to the C API for weakly-referencable types: Such types
must now initialize the extra field used by the weak-ref machinery to
NULL themselves, to avoid having to require PyObject_INIT() to check
if the type supports weak references and do it there. This causes less
work to be done for all objects (the type object does not need to be
consulted to check for the Py_TPFLAGS_HAVE_WEAKREFS bit).
Fred Drake [Thu, 22 Mar 2001 18:05:30 +0000 (18:05 +0000)]
Inform the cycle-detector that the a weakref object no longer needs to be
tracked as soon as it is clear; this can decrease the number of roots for
the cycle detector sooner rather than later in applications which hold on
to weak references beyond the time of the invalidation.
Fred Drake [Thu, 22 Mar 2001 17:52:17 +0000 (17:52 +0000)]
Make cPickle use the recently-added PyInstance_NewRaw() API to create
instance objects without calling the constructor. This is the same as
the new.instance() function.
Guido van Rossum [Thu, 22 Mar 2001 17:37:52 +0000 (17:37 +0000)]
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.)
Fred Drake [Thu, 22 Mar 2001 16:30:17 +0000 (16:30 +0000)]
Be more clear about the specific rules for supporting the cyclic GC in an
extension object. Also included an example showing exactly what needs to
be done and nothing else.
Thomas Wouters [Thu, 22 Mar 2001 14:50:24 +0000 (14:50 +0000)]
Allow the process of reading back what we wrote to a pty to transform
linefeeds into carriagereturn-linefeeds (which is apparently what IRIX
does.) Also add some comments, an extra test and reorganize it a bit.
Add 'platforms' and 'keywords' attributes to the DistributionMetadata class,
along with options to print them.
Add a finalize_options() method to Distribution to do final processing
on the platform and keyword attributes
Add DistributionMetadata.write_pkg_info() method to write a PKG-INFO file
into the release tree.
Jeremy Hylton [Thu, 22 Mar 2001 02:47:58 +0000 (02:47 +0000)]
Extend support for from __future__ import nested_scopes
If a module has a future statement enabling nested scopes, they are
also enable for the exec statement and the functions compile() and
execfile() if they occur in the module.
If Python is run with the -i option, which enters interactive mode
after executing a script, and the script it runs enables nested
scopes, they are also enabled in interactive mode.
XXX The use of -i with -c "from __future__ import nested_scopes" is
not supported. What's the point?
To support these changes, many function variants have been added to
pythonrun.c. All the variants names end with Flags and they take an
extra PyCompilerFlags * argument. It is possible that this complexity
will be eliminated in a future version of the interpreter in which
nested scopes are not optional.
Neil Schemenauer [Thu, 22 Mar 2001 00:32:32 +0000 (00:32 +0000)]
- Remove WITH makefile variable. Its not used for anything.
- Add CONFIG_ARGS variable and use it to re-run configure rather than
using config.status. This prevents an infinite loop if configure
dies while re-configuring.
Tim Peters [Wed, 21 Mar 2001 23:07:59 +0000 (23:07 +0000)]
Changed doctest to run tests in alphabetic order of name.
This makes verbose-mode output easier to dig thru, and removes an accidental
dependence on the order of dict.items() (made visible by recent changes to
dictobject.c).
Fred Drake [Wed, 21 Mar 2001 22:15:01 +0000 (22:15 +0000)]
Integrated an expanded version of some text from Neil Schemenauer about
supporting cyclic garbage collection. (This is not all of it, but I'm
taking a break!)