Commit Graph

1365 Commits

Author SHA1 Message Date
Guido van Rossum 7814ea64ff Last minute fix to Text.window_cget(), which should properly Tcl-ify
the option name (prepend '-', strip trailing '_').
1997-12-11 17:08:52 +00:00
Guido van Rossum 4d35e6f092 yeah, yeah. 1997-12-11 02:36:42 +00:00
Guido van Rossum 5ac00ac140 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.
1997-12-11 02:03:55 +00:00
Guido van Rossum d1f4984a9b 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.
1997-12-10 23:40:18 +00:00
Guido van Rossum d0753e20b2 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.
1997-12-10 22:59:55 +00:00
Guido van Rossum 90d62ab0a1 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...
1997-12-10 22:35:02 +00:00
Guido van Rossum e680546894 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.)
1997-12-10 19:36:41 +00:00
Guido van Rossum e44a8d9987 Support uue and x-uue as short names for uuencode. 1997-12-10 18:54:36 +00:00
Guido van Rossum 9ab94c18d8 Doc strings and reformatting with 4 spaces bty Mitch Chapman.
Untabified and minor tweaks by me.
1997-12-10 16:17:39 +00:00
Guido van Rossum 5bdea89c89 # Typos in the comments giving the names of two recently added distributions. 1997-12-09 19:43:18 +00:00
Guido van Rossum b978d18fec Guess... :-) 1997-12-09 16:56:41 +00:00
Guido van Rossum 3d20986d96 Checking in ConfigParser.py -- I don't see a reason why this can't be
liberated.  This was originally written by Ken and later revamped by
Barry.
1997-12-09 16:10:31 +00:00
Guido van Rossum 7b8970ac88 Deleting ni.py; renamed to ni1.py, really. 1997-12-09 14:58:26 +00:00
Guido van Rossum 6599fb0917 Make close(), and hence __del__(), robust in the light of the world
being destroyed already.
1997-12-09 14:18:33 +00:00
Guido van Rossum 41999c164e Doc strings by Mitch Chapman (with a little reformatting).
Also reformatted the whole module with 4 spaces and no tabs.
1997-12-09 00:12:23 +00:00
Guido van Rossum 6a99984e79 Use long() instead of int() to compare mktime(localtime(t) with t... 1997-12-08 21:48:01 +00:00
Guido van Rossum dfa6790bd6 New re version from AMK 1997-12-08 17:12:06 +00:00
Guido van Rossum c5d2d51700 Apply the same change to classes without an __getinitargs__() method
as in pickle: the new instance is created without calling __init__().
1997-12-07 16:18:22 +00:00
Guido van Rossum 61de0ac4bb Reindented according to new standard, without tabs.
Also added one more os2 specific piece of code, by Jeff Rush.
1997-12-05 21:24:30 +00:00
Guido van Rossum 63cf3960df ospath.py has been obsolete for long enough. 1997-12-05 19:49:14 +00:00
Guido van Rossum e467be6511 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.
1997-12-05 19:42:42 +00:00
Guido van Rossum 346f7af8ff Added doc strings and reindented according to new standard, without tabs.
(Like ntpath.py, this was contributed by "Charles G. Waldman" <cgw@pgt.com>)
1997-12-05 19:04:51 +00:00
Guido van Rossum 15e22e1c3a Added doc strings and reindented according to new standard, without tabs. 1997-12-05 19:03:01 +00:00
Guido van Rossum 7f9732880e Fix the exclusion of "config" in the methods copied from Pack to also
exclude "configure".
1997-12-05 17:05:04 +00:00
Guido van Rossum e612be5926 Patch my Marc Lemburg to fix urljoin("/a", "..") and urljoin("/a", "..#1"). 1997-12-03 22:38:56 +00:00
Guido van Rossum 3fa440ea91 Refinement of home for NT, courtesy Jeff Bauer. 1997-12-03 22:34:03 +00:00
Guido van Rossum ab76af3d65 Provide default for blocksize on retrbinary (Skip Montanaro). 1997-12-03 19:34:14 +00:00
Guido van Rossum 98ee50b5a4 More generated files for netbsd 1.x, by Anders Andersen. 1997-12-03 18:44:57 +00:00
Guido van Rossum 91221c29f2 Support for netbsd1 and freebsd3, after suggestions by Anders Andersen
and Jacques Vidrine.
1997-12-02 20:30:29 +00:00
Guido van Rossum c0f29c2d31 When a port is specified in an ftp:// URL, must convert it to a number! 1997-12-02 20:26:21 +00:00
Guido van Rossum 80f8be8901 Support for the "event" command, new in Tk 4.2.
By Case Roole.
1997-12-02 19:51:39 +00:00
Guido van Rossum 11fbef5f92 Sjoerd sez: global substitute \240 with \177. 1997-12-02 17:45:39 +00:00
Guido van Rossum 376467ada6 Added stropts.h to the list of files automatically regenerated. 1997-12-02 14:37:20 +00:00
Barry Warsaw 5284589097 Generated from Solaris 2.6's /usr/include/sys/stropts.h via
Tools/scripts/h2py.py.  This file contains many useful streamio(7)
constants, especially the ones that support passing open file
descriptors through a pipe: I_RECVFD and I_SENDFD.
1997-12-02 04:49:09 +00:00
Guido van Rossum 893a8cbae7 *** empty log message *** 1997-12-02 03:42:17 +00:00
Guido van Rossum cf4559a62e Added Pareto and Weibull distributions, courtesy Jeremy Hylton. 1997-12-02 02:47:39 +00:00
Barry Warsaw c99a239f42 Added strop.split tests when sep is None. 1997-12-02 00:30:04 +00:00
Guido van Rossum 06ba34c5d4 In string.split(), honor maxsplit (if > 0).
In string.splitfields(), ignore maxsplit if <= 0, rather than ignoring
maxsplit=0 but effectively treating negative numbers the same as
maxsplit=1.  Also made the test for maxsplit slightly more efficient
(set it to the length of the string when <= 0 so the test for its
presence can be omitted from the loop).
1997-12-01 15:25:19 +00:00
Barry Warsaw 58a88b3e34 _Environ(): Added __getinitargs__() method so os.environ.copy() works,
as does unpickling, as in: pickle.loads(pickle.dumps(os.environ)).

Hope this is right!  Don't shoot me Guido. :-)
1997-12-01 04:30:19 +00:00
Barry Warsaw 9181190c76 Added tests of strop.replace() 1997-11-29 00:25:30 +00:00
Guido van Rossum 0b23348aa9 The usual 1997-11-26 15:44:34 +00:00
Guido van Rossum e2d4dd194b Use fuzzy comparison from test_support to compare outcome of
pow(x,y,z) to pow(x,y)%z.
1997-11-24 22:24:22 +00:00
Guido van Rossum 8e9ebfd337 os2 patch by Jeff Rush 1997-11-22 21:53:48 +00:00
Guido van Rossum c0b93191e6 bind_class should return a value 1997-11-22 21:49:56 +00:00
Guido van Rossum be7c45eec4 New address parser by Ben Escoto replaces
Sjoerd Mullender's parseaddr()
1997-11-22 21:49:19 +00:00
Guido van Rossum e6c128f428 Use fstat if we can; write MAGIC into file last. 1997-11-22 21:48:26 +00:00
Guido van Rossum 7d5b99d8bf A new standard module, as discussed on comp.lang.python, to simplify
the writing of filters.

Typical use is:

    import fileinput
    for line in fileinput.input():
        process(line)

This iterates over the lines of all files listed in sys.argv[1:],
defaulting to sys.stdin if the list is empty or when a filename is
'-'.

There is also an option to use this to direct the output back to the
input files.
1997-11-21 17:12:59 +00:00
Barry Warsaw 3d96d522ec (Queue.Empty): When class based exceptions are in force, derive this
class from the standard base exception Exception.  Otherwise define
Queue.Empty as a string exception.

(Queue): 8-space to 4-space indentation conversion.  Also, basically
recast all method comments into docstrings.
1997-11-20 19:56:38 +00:00
Guido van Rossum bd1169a93e Add Martin von Loewis as the author of this module. 1997-11-19 19:02:09 +00:00
Guido van Rossum eef1d4e8b1 User-level locale module. A wrapper around _locale which adds
format(), str(), atof(), and atoi().  The last three are locale
sensitive versions of the corresponding standard functions (only for
numbers though); format() does general %[efg] formatting taking the
locale into account, optionally with thousands grouping.
1997-11-19 19:01:43 +00:00