Guido van Rossum [Thu, 11 Dec 1997 02:03:55 +0000 (02:03 +0000)]
Fix problem detected by Greg McFarlane -- callbacks passed to
bind_class() and bind_all() are destroyed when the widget to which
they were passed is destroyed.
Guido van Rossum [Wed, 10 Dec 1997 23:40:18 +0000 (23:40 +0000)]
Jim Fulton writes:
The attached patch adds the following behavior to the handling
of REDUCE codes:
- A user-defined type may have a __reduce__ method that returns
a string rather than a tuple, in which case the object is
saved as a global object with a name given by the string returned
by reduce.
This was a feature added to cPickle a long time ago.
- User-defined types can now support unpickling without
executing a constructor.
The second value returned from '__reduce__' can now be None,
rather than an argument tuple. On unpickling, if the
second value returned from '__reduce__' during pickling was
None, then rather than calling the first value returned from
'__reduce__', directly, the '__basicnew__' method of the
first value returned from '__reduce__' is called without
arguments.
I also got rid of a few of Chris' extra ()s, which he used
to make python ifs look like C ifs.
Guido van Rossum [Wed, 10 Dec 1997 22:59:55 +0000 (22:59 +0000)]
At Barry's suggestion, plug the security leak by using an empty
__builtins__ for all calls to eval(). This still allows someone to
write string.atof("[1]*1000000") (which Jim Fulton worries about) but
effectively disables access to system modules and functions.
Guido van Rossum [Wed, 10 Dec 1997 22:35:02 +0000 (22:35 +0000)]
Since this module is used as a fallback in case no built-in modules
have been configured, string.atof() should not fail when "import re"
fails (usually because pcre is not there).
This opens up a tiny security hole: *if* an attacker can make "import
re" fail, they can also make string.atof(arbitrary_string) evaluate
the arbitrary string. Nothing to keep me awake at night...
Guido van Rossum [Wed, 10 Dec 1997 19:36:41 +0000 (19:36 +0000)]
Don't specify base 0 to string.atoi when unpickling integers in text
mode. The pickler always uses base 10 so the default base should be
fine. (The base gets us in trouble when there's no strop module, as
the atoi() in string.py only supports base 10. This is for JPython.)
Guido van Rossum [Wed, 10 Dec 1997 15:14:24 +0000 (15:14 +0000)]
Modified quicksort by Raymund Galvin, after studying the GNU libg++
quicksort. This should be much faster if there are lots of
duplicates, and otherwise at least as good.
Guido van Rossum [Wed, 10 Dec 1997 05:50:18 +0000 (05:50 +0000)]
Adding a new project: pythonw, or WinMain.c, containing a main program
that doesn't have a console window attached. stdout/stderr are lost.
This is handy though for things like grail.
Add explicit check for correct next character in format at end of
format. This will complain about illegal formats like "O#" instead of
ignoring the '#'.
Fred Drake [Tue, 9 Dec 1997 15:18:33 +0000 (15:18 +0000)]
libainstall: Install Modules/Setup.thread in addition to Modules/Setup and
Modules/Setup.local.
Guido: I hope this is ok; it seems to make a lot of sense to get the
whole trio of module config files installed as a set rather than
doing it partially.
Fix subtle bug in cleanup code in PyErr_NormalizeException(), detected
by Marc Lemburg. There's a path through the code where *val is NULL,
but value isn't, and value should be DECREF'ed.
Fred Drake [Mon, 8 Dec 1997 21:25:41 +0000 (21:25 +0000)]
Separated the definitions of ntohs(), ntohl(), htons(), htonl(). Separate
descriptions really make things look a bit better, and should improve the
ability to re-purpose the content.
Fred Drake [Mon, 8 Dec 1997 20:58:13 +0000 (20:58 +0000)]
Added Emacs turd so this file has the correct mode in Emacs / X/Emacs.
clean_key(): Override the standard LaTeX2HTML clean_key() to remove a
leading HTML tag, if present. This broke the indexes for the library
reference (at least) since many of the strings began with <code> or
something similar.
- Loading non-binary string pickles checks for insecure
strings. This is needed because cPickle (still)
uses a restricted eval to parse non-binary string pickles.
This change is needed to prevent untrusted
pickles like::
- User-defined types can now support unpickling without
executing a constructor.
The second value returned from __reduce__ can now be None,
rather than an argument tuple. On unpickling, if the second
value returned from __reduce__ during pickling was None, then
rather than calling the first value returned from __reduce__,
directly, the __basicnew__ method of the first value returned
from __reduce__ is called without arguments.
Fred Drake [Sat, 6 Dec 1997 07:25:41 +0000 (07:25 +0000)]
Some reorganization (all limit operations & constants together, and all usage
functions and constants together).
Make explicit datadesc sections for each of the constants which might appear,
and have a description of each. (Descriptions are based on the Linux
documentation and sources and the Solaris man pages.)
Hopefully Jeremy won't mind, because I didn't ask. ;-)
New WML file, this time with working Title and Author tags, and
mapping chapter and section headings to more appropriate nodes so that
the TOC actually works. Now generates one HTML page per chapter.
- Use the correct platform-specific delimiter and library location in
the usage message
(Also removed two blank lines and moved one line around so that each
part of the usage message is again under 512 bytes and the whole usage
message still fits in 23 lines.)
When instantiating a class with no arguments and where the class does
not define __getinitargs__, bypass the __init__ constructor
completely. This uses the trick of instantiating an empty dummy class
and then changing inst.__class__ to the real class. This is done in
two places: once for the INST and once for the OBJ format code.
Also replaced the much outdated long doc string with a short summary
of the module; the information of that doc string is already
incorporated in the library reference manual.
Fred Drake [Thu, 4 Dec 1997 14:36:52 +0000 (14:36 +0000)]
Fixed unresolved reference problem; this module wasn't \label{}ed.
Remove spurious underscore following book title. Added specific reference to
a Win32 networking book.
Changed \indexsubitem from (in module SocketServer) to (SocketServer protocol),
since it's talking about a protocol supported by a collection of classes.
When --with-thread(s) is specified, the thread module is now automatically
enabled. This is done through a substitution in Modules/Setup.thread(.in).
Bill Janssen will be happy. The original idea was by Lele Gaifax (though
I changed the implementation to use a separate file).
Moved the thread module to its own Setup.thread(.in) file,
which is edited by the config.status script depending on whether
--with-thread is specified or not. Also needs changes to configure(.in).
Fred Drake [Wed, 3 Dec 1997 19:44:27 +0000 (19:44 +0000)]
make_str_index_entry(): New function. Similar to make_index_entry(), but
includes the string in the returned value instead of the dummy
filler character.
add_idx(): Override the latex2html function of the same name; this gets
the anchor properly embedded in the <dt> element, so the index
works in Grail too.
Barry Warsaw [Wed, 3 Dec 1997 05:25:48 +0000 (05:25 +0000)]
(py-jump-on-exception): Variable which if t, means that if an
exception occurs in a synchronous Python subprocess, the mode will
automatically jump to the innermost exception.
Barry Warsaw [Wed, 3 Dec 1997 05:03:44 +0000 (05:03 +0000)]
Removed redundant eval-when-compile.
(python-mode): Conditionalize imenu initializations to when we can
safely require imenu. Under Emacs this should prevent python-mode
from hosing the global value of imenu-create-index-function and
messing things up for all other modes. Problem identified by
Christian Egli.
(py-describe-mode): py-delete-char => py-electric-backspace. Given by
Christian Egli.
Fred Drake [Wed, 3 Dec 1997 04:06:57 +0000 (04:06 +0000)]
The biggie: changed the funcdesc environments used for opcode descriptions
to use the opcodedesc environment.
Changed a \code{} to a \file{} near the start where a file is referenced.
Fixed a typo: "on" --> "one" in ROT_THREE description.
Wherever opcodes were referenced by name, use \code{OPCODE_NAME}; usage was
inconsistent. Ideally, another macro would be defined since these don't
represent code a programmer would type, but that's minor even for me. It'll
probably get converted automatically in the SGML conversion project. Whether
that matters or not isn't relevant at this point.
Fred Drake [Wed, 3 Dec 1997 03:42:39 +0000 (03:42 +0000)]
Added environment for defining PyVM instructions. This is only used in
the libdis.tex file I'm about to check in.
I'm not sure this is really an optimal solution yet, but it may be the best
alternative. It avoids describing the instructions as either data items or
functions.
This change was discussed with Guido. (Guido: Take a look at the LaTeX
output for this; if this is reasonable I'll go ahead and update the perl
code in myformat.perl to match.)
Change the default repr() and str() of class instance objects to look
like <modulename.classname instance at ...> (to match the repr() of
class objects.