Commit Graph

1285 Commits

Author SHA1 Message Date
Tim Peters d64c1def7c k_mul() and long_mul(): I'm confident that the Karatsuba algorithm is
correct now, so added some final comments, did some cleanup, and enabled
it for all long-int multiplies.  The KARAT envar no longer matters,
although I left some #if 0'ed code in there for my own use (temporary).
k_mul() is still much slower than x_mul() if the inputs have very
differenent sizes, and that still needs to be addressed.
2002-08-12 17:36:03 +00:00
Guido van Rossum e343878eec New news about __class__ assignment restrictions and speed-up of
new-style object creation/deallocation.

Moved all news about type/class unification and new-stype classes to a
separate section at the top.
2002-08-12 03:42:03 +00:00
Neal Norwitz 6c70fca8b1 Revert what looks like a typo from the last checkin 2002-08-12 03:33:32 +00:00
Tim Peters 5af4e6c739 Cautious introduction of a patch that started from
SF 560379:  Karatsuba multiplication.
Lots of things were changed from that.  This needs a lot more testing,
for correctness and speed, the latter especially when bit lengths are
unbalanced.  For now, the Karatsuba code gets invoked if and only if
envar KARAT exists.
2002-08-12 02:31:19 +00:00
Marc-André Lemburg cc8764ca9d Add C API PyUnicode_FromOrdinal() which exposes unichr() at C level.
u'%c' will now raise a ValueError in case the argument is an
integer outside the valid range of Unicode code point ordinals.

Closes SF bug #593581.
2002-08-11 12:23:04 +00:00
Mark Hammond 8f3afc7cd3 Clarify that the interruptable popen fixes aren't used under Win9x. 2002-08-10 06:26:31 +00:00
Guido van Rossum bffb2efee0 Credit to Oren for the file-iterator patch. 2002-08-09 17:17:07 +00:00
Guido van Rossum deb0936795 News about the tempfile rewrite. 2002-08-09 17:16:30 +00:00
Guido van Rossum d81a9834f7 News about Neil's fix to correctly invoke __rmul__. 2002-08-09 15:57:34 +00:00
Sjoerd Mullender b6434f2c2f Document that -u puts stdin, stdout, and stderr in binary mode. 2002-08-09 13:37:31 +00:00
Barry Warsaw d79f683772 Describe new "str1 in str2" behavior. 2002-08-06 17:01:51 +00:00
Guido van Rossum b57089cdf8 Files are now their own iterator. The xreadlines method and module
are obsolete.
2002-08-06 16:20:26 +00:00
Guido van Rossum 2805428d92 SF patch 590294: os._execvpe security fix (Zack Weinberg). 2002-08-05 16:14:46 +00:00
Fred Drake 40813b1dbc Typo: "now" --> "the new" 2002-08-05 15:24:19 +00:00
Martin v. Löwis 98ce7b7ef1 IDLE support for PEP 263. 2002-08-05 15:11:26 +00:00
Guido van Rossum de392d3f3f Add a small description of PEP 263. 2002-08-05 14:17:20 +00:00
Martin v. Löwis 00f1e3f5a5 Patch #534304: Implement phase 1 of PEP 263. 2002-08-04 17:29:52 +00:00
Andrew MacIntyre 161ad0e16b OS/2 EMX now supported 2002-08-04 07:25:58 +00:00
Guido van Rossum 4a57c33dff Adding the heap queue algorithm, per discussion in python-dev last
week.
2002-08-02 18:05:20 +00:00
Guido van Rossum 37c3b2788b Add Kevin O'Connor, author of the heapq code. 2002-08-02 16:50:58 +00:00
Guido van Rossum 0dbab4c560 SF patch 588728 (Nathan Srebro).
The __delete__ method wrapper for descriptors was not supported

(I added a test, too.)

2.2 bugfix candidate.
2002-08-01 14:39:25 +00:00
Tim Peters f47630ff54 A blurb about the sort implementation. 2002-08-01 02:34:51 +00:00
Michael W. Hudson 202a4b6fdd Repair fill-paragraph damage.
Clarify LLTRACE description.  It was introduced in 1992, revision 2.20 of
ceval.c, well before Python 1.0!
2002-07-30 15:25:57 +00:00
Michael W. Hudson a6255238b2 add description of LLTRACE. 2002-07-30 09:49:29 +00:00
Thomas Heller 085358a3e2 New functions for extension writers on Windows:
PyErr_SetExcFromWindowsErr(), PyErr_SetExcFromWindowsErrWithFilename().

Similar to PyErr_SetFromWindowsErrWithFilename() and
PyErr_SetFromWindowsErr(), but they allow to specify
the exception type to raise. Available on Windows.

See SF patch #576458.
2002-07-29 14:27:41 +00:00
Martin v. Löwis 0cec0ffc78 Patch #573770: Implement lchown. 2002-07-28 16:33:45 +00:00
Martin v. Löwis 611a7101ca Patch #552812: Better description in "python -h" for -u. 2002-07-28 10:34:08 +00:00
Guido van Rossum 2d5389c08f News about StopIteration as a "sink state". 2002-07-23 03:44:35 +00:00
Guido van Rossum 79f0a106e6 Add news about strptime and socket.setdefaulttimeout(). 2002-07-23 03:32:08 +00:00
Neal Norwitz 1389f3e059 Move DL_IMPORT/DL_EXPORT to Build section, I think this is the correct place 2002-07-22 13:21:10 +00:00
Mark Hammond a5083ec3b3 Add note about DL_IMPORT deprecation.
[ 583894 ] doc DL_IMPORT/DL_EXPORT changes
2002-07-22 12:53:16 +00:00
Neal Norwitz 36eb4b2d7e Pure Python strptime implementation by Brett Cannon. See SF patch 474274. 2002-07-19 18:38:25 +00:00
Barry Warsaw f31ff27c57 (py-pychecker-run): Use the last pychecker invocation as the default
contents of the next command.
2002-07-17 21:25:43 +00:00
Barry Warsaw 1f4fed68e9 We need to (require 'compile) to guarantee that compile-internal is
defined.  /Really/ closes SF # 580631.
2002-07-17 13:45:00 +00:00
Barry Warsaw 32a03967b7 (py-imenu-create-index-function): Skip over stuff that looks like code
but which is in a comment or string.  Closes SF bug # 572341 reported
by Adrian van den Dries.
2002-07-16 16:04:13 +00:00
Barry Warsaw daa192104d (py-pychecker-run): Thomas Heller points out that this function messes
up the compile command's history.  Fix that by using compile-internal.

Fixes SF bug # 580631
2002-07-16 15:56:28 +00:00
Mark Hammond c0e35158fb Add a blurb on the 3 Windows bugs I worked on over the last couple of days. 2002-07-16 01:32:30 +00:00
Tim Peters a65523a151 Added Andrew MacIntyre -- overdue! 2002-07-15 16:13:06 +00:00
Tim Peters 58cf361e35 docompare(): Another reasonable optimization from Jonathan Hogg for the
explicit comparison function case:  use PyObject_Call instead of
PyEval_CallObject.  Same thing in context, but gives a 2.4% overall
speedup when sorting a list of ints via list.sort(__builtin__.cmp).
2002-07-15 05:16:13 +00:00
Marc-André Lemburg 58e2ff2e81 Mention new encoding. 2002-07-12 14:40:04 +00:00
Guido van Rossum dd523eef95 Fernando Pérez of SF bug 579701 fame. 2002-07-12 13:13:28 +00:00
Guido van Rossum 0c08864fbb Replace rare tabs with 4 spaces, assuming that's what was intended. 2002-07-11 01:04:32 +00:00
Guido van Rossum 715a0c67b8 Note the existence of SpecialBuilds.txt. 2002-07-11 01:01:49 +00:00
Tim Peters 8acdf7a935 Noted the releases in which COUNT_ALLOCS can blow up. 2002-07-11 00:38:05 +00:00
Tim Peters 62fc52e6a1 Recorded the introduction release for each gimmick, as best I was able to
reconstruct that info.
Filled out some sketchy explanations of pragmatics.
2002-07-11 00:23:58 +00:00
Tim Peters 20c8a04a08 Some clarifications. 2002-07-11 00:02:52 +00:00
Tim Peters 889f61dcfb Documented PYMALLOC_DEBUG. This completes primary coverage of all the
"special builds" I ever use.  If you use others, document them here, or
don't be surprised if I rip out the code for them <0.5 wink>.
2002-07-10 19:29:49 +00:00
Tim Peters a788f5ef02 Clarified sys.getobjects() pragmatics. 2002-07-10 18:47:03 +00:00
Tim Peters 44c1a7bc51 Typo repair. 2002-07-09 19:27:20 +00:00
Tim Peters 48ba649ae3 Moved COUNT_ALLOCS down and finished writing its description. 2002-07-09 19:24:54 +00:00
Tim Peters 3486f617a1 Checkin comment. 2002-07-09 18:48:32 +00:00
Tim Peters 6045d48e5c New file to try to document the "special build" preprocessor symbols.
Incomplete.  Add to it!  Once it settles down, it would make a nice
appendix in the real docs.
2002-07-09 18:35:34 +00:00
Tim Peters 7c321a80f9 The Py_REF_DEBUG/COUNT_ALLOCS/Py_TRACE_REFS macro minefield: added
more trivial lexical helper macros so that uses of these guys expand
to nothing at all when they're not enabled.  This should help sub-
standard compilers that can't do a good job of optimizing away the
previous "(void)0" expressions.

Py_DECREF:  There's only one definition of this now.  Yay!  That
was that last one in the family defined multiple times in an #ifdef
maze.

Py_FatalError():  Changed the char* signature to const char*.

_Py_NegativeRefcount():  New helper function for the Py_REF_DEBUG
expansion of Py_DECREF.  Calling an external function cuts down on
the volume of generated code.  The previous inline expansion of abort()
didn't work as intended on Windows (the program often kept going, and
the error msg scrolled off the screen unseen).  _Py_NegativeRefcount
calls Py_FatalError instead, which captures our best knowledge of
how to abort effectively across platforms.
2002-07-09 02:57:01 +00:00
Tim Peters c6a3ff634a SF bug 578752: COUNT_ALLOCS vs heap types
Repair segfaults and infinite loops in COUNT_ALLOCS builds in the
presence of new-style (heap-allocated) classes/types.

Bugfix candidate.  I'll backport this to 2.2.  It's irrelevant in 2.1.
2002-07-08 22:11:52 +00:00
Tim Peters 943382c8e5 Removed WITH_CYCLE_GC #ifdef-ery. Holes:
+ I'm not sure what to do about configure.in.  Left it alone.

+ Ditto pyexpat.c.  Fred or Martin will know what to do.
2002-07-07 03:59:34 +00:00
Tim Peters 1de41bfbc0 Stop trying to cater to platforms with a broken HUGE_VAL definition. It
breaks other platforms (in this case, the hack for broken Cray systems in
turn caused failure on a Mac system broken in a different way).
2002-07-03 03:31:20 +00:00
Martin v. Löwis 7d650ca83b Implement the encoding argument for toxml and toprettyxml.
Document toprettyxml.
2002-06-30 15:05:00 +00:00
Jeremy Hylton 3e76d7f3b3 Add Bob Kline of HTTP 100 fame. 2002-06-28 22:39:56 +00:00
Raymond Hettinger 5a04aec384 Fix SF bug 546434 -- buffer slice type inconsistent. 2002-06-25 00:25:30 +00:00
Raymond Hettinger ab5dae35ca Fix SF bug 572567: Memory leak in object comparison. 2002-06-24 13:08:16 +00:00
Guido van Rossum c7c36503eb Mention private vars in __slots__. 2002-06-21 01:29:25 +00:00
Guido van Rossum fe0ca4a0f5 Mention pymemcompat.h. 2002-06-18 21:20:13 +00:00
Guido van Rossum f925782dae Minor tweaks to existing items (radian/degree, and UTF-16 readers.. 2002-06-18 20:43:18 +00:00
Guido van Rossum 63517577fd Patch from SF bug 570483 (Tim Northover).
In a fresh interpreter, type.mro(tuple) would segfault, because
PyType_Ready() isn't called for tuple yet.  To fix, call
PyType_Ready(type) if type->tp_dict is NULL.
2002-06-18 16:44:57 +00:00
Walter Dörwald 3430d70e03 Apply diff2.txt from SF patch http://www.python.org/sf/566999
This patch enhances Python/import.c/find_module() so
that unicode objects found in sys.path will be treated
as legal directory names (The current code ignores
anything that is not a str). The unicode name is
converted to str using Py_FileSystemDefaultEncoding.
2002-06-17 10:43:59 +00:00
Guido van Rossum 9562bcf3bc Add Oren Tirosh and news about his patch. 2002-06-14 21:31:18 +00:00
Guido van Rossum bea18ccde6 SF patch 568629 by Oren Tirosh: types made callable.
These built-in functions are replaced by their (now callable) type:

    slice()
    buffer()

and these types can also be called (but have no built-in named
function named after them)

    classobj (type name used to be "class")
    code
    function
    instance
    instancemethod (type name used to be "instance method")

The module "new" has been replaced with a small backward compatibility
placeholder in Python.

A large portion of the patch simply removes the new module from
various platform-specific build recipes.  The following binary Mac
project files still have references to it:

    Mac/Build/PythonCore.mcp
    Mac/Build/PythonStandSmall.mcp
    Mac/Build/PythonStandalone.mcp

[I've tweaked the code layout and the doc strings here and there, and
added a comment to types.py about StringTypes vs. basestring.  --Guido]
2002-06-14 20:41:17 +00:00
Skip Montanaro 57454e57f8 This introduces stricter library/header file checking for the Berkeley DB
library.  Since multiple versions can be installed simultaneously, it's
crucial that you only select libraries and header files which are compatible
with each other.  Version checking is done from highest version to lowest.
Building using version 1 of Berkeley DB is disabled by default because of
the hash file bugs people keep rediscovering.  It can be enabled by
uncommenting a few lines in setup.py.  Closes patch 553108.
2002-06-14 20:30:31 +00:00
Neal Norwitz 1f68fc7fa5 SF bug # 493951 string.{starts,ends}with vs slices
Handle negative indices similar to slices.
2002-06-14 00:50:42 +00:00
Martin v. Löwis 606edc1d97 Patch #568235: Add posix.setpgid. 2002-06-13 21:09:11 +00:00
Guido van Rossum 2e82e717e6 Changed the extended slice example to show that you can reverse a
string with a [::-1] slice.
2002-06-13 11:41:07 +00:00
Guido van Rossum c5fe5eb8d2 SF bug 567538: Generator can crash the interpreter (Finn Bock).
This was a simple typo.  Strange that the compiler didn't catch it!
Instead of WHY_CONTINUE, two tests used CONTINUE_LOOP, which isn't a
why_code at all, but an opcode; but even though 'why' is declared as
an enum, comparing it to an int is apparently not even worth a
warning -- not in gcc, and not in VC++. :-(

Will fix in 2.2 too.
2002-06-12 03:45:21 +00:00
Michael W. Hudson 5efaf7eac8 This is my nearly two year old patch
[ 400998 ] experimental support for extended slicing on lists

somewhat spruced up and better tested than it was when I wrote it.

Includes docs & tests.  The whatsnew section needs expanding, and arrays
should support extended slices -- later.
2002-06-11 10:55:12 +00:00
Martin v. Löwis f90ae20354 Patch #488073: AtheOS port. 2002-06-11 06:22:31 +00:00
Guido van Rossum 9f7549bfc7 Record the latest fixes. 2002-06-10 21:39:42 +00:00
Guido van Rossum 009afb7c90 SF patch 564549 (Erik Andersén).
The WeakKeyDictionary constructor didn't work when a dict arg was
given.  Fixed by moving a line.  Also adding a unit test.

Bugfix candidate.
2002-06-10 20:00:52 +00:00
Martin v. Löwis a3fb4f7816 Patch #505375: Make doc strings optional. 2002-06-09 13:33:54 +00:00
Guido van Rossum 2a664a2a75 Added Bernard Yue who wrote test_timeout.py and participated in the
timeout socket patch design.
2002-06-07 15:58:53 +00:00
Guido van Rossum 5033c8e309 Add timeout mode. Clarify gnu_getopt. 2002-06-07 12:40:52 +00:00
Guido van Rossum 15699055e9 Michael Gilfix of SF patch 555085 fame. 2002-06-06 21:08:46 +00:00
Martin v. Löwis 446a25fa3c Patch 473512: add GNU style scanning as gnu_getopt. 2002-06-06 10:58:36 +00:00
Guido van Rossum 9923ffe2c0 Address SF bug 519621: slots weren't traversed by GC.
While I was at it, I added a tp_clear handler and changed the
tp_dealloc handler to use the clear_slots helper for the tp_clear
handler.

Also tightened the rules for slot names: they must now be proper
identifiers (ignoring the dirty little fact that <ctype.h> is locale
sensitive).

Also set mp->flags = READONLY for the __weakref__ pseudo-slot.

Most of this is a 2.2 bugfix candidate; I'll apply it there myself.
2002-06-04 19:52:53 +00:00
Michael W. Hudson b0dc1a38a1 Fiddle wording. 2002-06-04 18:27:35 +00:00
Neal Norwitz b5b5a260ea Fix SF bug #557436, TclError is a str should be an Exception
Make Tkinter.TclError derive from Exception, it was a string.
2002-06-04 17:14:07 +00:00
Walter Dörwald 474458da48 Add constants BOM_UTF8, BOM_UTF16, BOM_UTF16_LE, BOM_UTF16_BE,
BOM_UTF32, BOM_UTF32_LE and BOM_UTF32_BE that represent the Byte
Order Mark in UTF-8, UTF-16 and UTF-32 encodings for little and
big endian systems.

The old names BOM32_* and BOM64_* were off by a factor of 2.

This closes SF bug http://www.python.org/sf/555360
2002-06-04 15:16:29 +00:00
Guido van Rossum 2e4e02620b Surprising fix for SF bug 563060: module can be used as base class.
Change the module constructor (module_init) to have the signature
__init__(name:str, doc=None); this prevents the call from type_new()
to succeed.  While we're at it, prevent repeated calling of
module_init for the same module from leaking the dict, changing the
semantics so that __dict__ is only initialized if NULL.

Also adding a unittest, test_module.py.

This is an incompatibility with 2.2, if anybody was instantiating the
module class before, their argument list was probably empty; so this
can't be backported to 2.2.x.
2002-06-04 05:58:34 +00:00
Neal Norwitz 32a7e7f6b6 Change name from string to basestring 2002-05-31 19:58:02 +00:00
Fred Drake 1e9abf0efd Typo fixes. 2002-05-30 16:41:14 +00:00
Michael W. Hudson e4df27f084 Add the pymemcompat.h header as discussed on python-dev.
Now we just need to make sure people know about it...
2002-05-30 16:22:29 +00:00
Guido van Rossum 5c16468ada Holger Krekel. 2002-05-30 15:42:58 +00:00
Neal Norwitz d68f5171eb As discussed on python-dev, add a mechanism to indicate features
that are in the process of deprecation (PendingDeprecationWarning).
Docs could be improved.
2002-05-29 15:54:55 +00:00
Michael W. Hudson 34f20eac98 This is patch
[ 559250 ] more POSIX signal stuff

Adds support (and docs and tests and autoconfery) for posix signal
mask handling -- sigpending, sigprocmask and sigsuspend.
2002-05-27 15:08:24 +00:00
Guido van Rossum cacfc07d08 - A new type object, 'string', is added. This is a common base type
for 'str' and 'unicode', and can be used instead of
  types.StringTypes, e.g. to test whether something is "a string":
  isinstance(x, string) is True for Unicode and 8-bit strings.  This
  is an abstract base class and cannot be instantiated directly.
2002-05-24 19:01:59 +00:00
Tim Peters 84ee323cb9 John Aycock correctly pointed out that the grammar for
"power" was formally ambiguous.  Here's his fix.
2002-05-23 20:05:40 +00:00
Barry Warsaw f070cce6af (py-goto-statement-below): Watch out for landing in a triple quoted
string with text in column zero.  Skip that stuff when looking for the
"first statement following the statement containing point".
2002-05-23 19:42:16 +00:00
Guido van Rossum fecdb494da Another one. 2002-05-21 12:38:46 +00:00
Barry Warsaw 47f3e2cb6c Add a bit of news about the email package fixes. 2002-05-20 00:14:24 +00:00
Raymond Hettinger f077f790c4 Added (with GvR's endorsement) Matthew Dixon Cowles
for his service on the Python-Help maillist.
2002-05-16 13:42:48 +00:00
Raymond Hettinger 87f59eeb0a Noted SF patch 552452 adding degree/radian conversions to mathmodule.c. 2002-05-13 04:17:32 +00:00
Barry Warsaw 69c9266f45 (py-execute-region): Do the blank line skipping inside the
save-excursion so that when the function is complete, point is
preserved.
2002-05-12 17:37:46 +00:00
Raymond Hettinger 9b1df1db68 Noted change in ftplib 1.68 closing SF patch 553277. 2002-05-12 06:07:21 +00:00
Andrew M. Kuchling b2cb37f298 Fix typo 2002-05-09 14:33:18 +00:00
Neil Schemenauer c9abc1de6b Remove news about PyMalloc_*. Do we need to say anything about
pymalloc?
2002-05-08 14:14:41 +00:00
Martin v. Löwis a8dd0941b8 Patch #553277: Accept callbacks that are callable, not callbacks that are true. 2002-05-08 08:56:33 +00:00
Martin v. Löwis 01f94bda38 Patch #552433: Special-case tuples. Avoid sub-type checking for lists.
Avoid checks for negative indices and duplicate checks for support of
the sequence protocol.
2002-05-08 08:44:21 +00:00
Andrew M. Kuchling 21b23b09a2 Fix typos 2002-05-07 20:58:03 +00:00
Tim Peters 46c04e140c random.gauss() uses a piece of hidden state used by nothing else,
and the .seed() and .whseed() methods failed to reset it.  In other
words, setting the seed didn't completely determine the sequence of
results produced by random.gauss().  It does now.  Programs repeatedly
mixing calls to a seed method with calls to gauss() may see different
results now.

Bugfix candidate (random.gauss() has always been broken in this way),
despite that it may change results.
2002-05-05 20:40:00 +00:00
Fred Drake d0ba636541 Added notes related to the removal of deprecated features of the xrange type. 2002-05-02 21:28:26 +00:00
Fred Drake 7d28b73ec1 Added note about using the documentation build tools under Cygwin. 2002-05-02 21:17:00 +00:00
Fred Drake 7f781c9aab Add Pickler.clear_memo() so the pickle and cPickle modules are more similar. 2002-05-01 20:33:53 +00:00
Barry Warsaw 5dfc7afff9 Watch out for older XEmacsen for which requiring info-look doesn't
define info-lookup-maybe-add-help.
2002-04-30 18:58:52 +00:00
Tim Peters 81b9251d59 Mostly in SequenceMatcher.{__chain_b, find_longest_match}:
This now does a dynamic analysis of which elements are so frequently
repeated as to constitute noise.  The primary benefit is an enormous
speedup in find_longest_match, as the innermost loop can have factors
of 100s less potential matches to worry about, in cases where the
sequences have many duplicate elements.  In effect, this zooms in on
sequences of non-ubiquitous elements now.

While I like what I've seen of the effects so far, I still consider
this experimental.  Please give it a try!
2002-04-29 01:37:32 +00:00
Guido van Rossum 26dd830123 Clarify that the strip changes also apply to Unicode. 2002-04-26 20:11:29 +00:00
Guido van Rossum 7dab2426ca - New builtin function enumerate(x), from PEP 279. Example:
enumerate("abc") is an iterator returning (0,"a"), (1,"b"), (2,"c").
  The argument can be an arbitrary iterable object.
2002-04-26 19:40:56 +00:00
Barry Warsaw 17afa13a9f (py-comint-output-filter-function): Put the pop-to-buffer call inside
the `when' condition so other non-Python shell comint changes won't
cause random buffers to pop.
2002-04-26 15:49:52 +00:00
Guido van Rossum 517c7d4fd3 PyNumber_CoerceEx: this took a shortcut (not doing anything) when the
left and right type were of the same type and not classic instances.

This shortcut is dangerous for proxy types, because it means that
coerce(Proxy(1), Proxy(2.1)) leaves Proxy(1) unchanged rather than
turning it into Proxy(1.0).

In an ever-so-slight change of semantics, I now only take the shortcut
when the left and right types are of the same type and don't have the
CHECKTYPES feature.  It so happens that classic instances have this
flag, so the shortcut is still skipped in this case (i.e. nothing
changes for classic instances).  Proxies also have this flag set
(otherwise implementing numeric operations on proxies would become
nightmarish) and this means that the shortcut is also skipped there,
as desired.  It so happens that int, long and float also have this
flag set; that means that e.g. coerce(1, 1) will now invoke
int_coerce().  This is fine: int_coerce() can deal with this, and I'm
not worried about the performance; int_coerce() is only invoked when
the user explicitly calls coerce(), which should be rarer than rare.
2002-04-26 02:49:14 +00:00
Neil Schemenauer 89e3ee0ccf If Py_OptimizeFlag is false then always evaluate assert conditions, don't
test __debug__ at runtime.  Closes SF patch #548833.
2002-04-26 01:58:53 +00:00
Barry Warsaw cf22c826a6 Fix typo in the setup of interpreter-mode-alist. 2002-04-25 21:46:33 +00:00
Barry Warsaw 884916112e SF patch #510288 by Kevin J. Butler, mod'd by Barry. This provides
better auto-recognition of a Jython file vs. a CPython (or agnostic)
file by looking at the #! line more closely, and inspecting the import
statements in the first 20000 bytes (configurable).  Specifically,

(py-import-check-point-max): New variable, controlling how far into
the buffer it will search for import statements.

(py-jpython-packages): List of package names that are Jython-ish.

(py-shell-alist): List of #! line programs and the modes associated
with them.

(jpython-mode-hook): Extra hook that runs when entering jpython-mode
(what about Jython mode? <20k wink>).

(py-choose-shell-by-shebang, py-choose-shell-by-import,
py-choose-shell): New functions.

(python-mode): Use py-choose-shell.

(jpython-mode): New command.

(py-execute-region): Don't use my previous hacky attempt at doing
this, use the new py-choose-shell function.

One other thing this file now does: it attempts to add the proper
hooks to interpreter-mode-alist and auto-mode-alist if they aren't
already there.  Might help with Emacs users since that editor doesn't
come with python-mode by default.
2002-04-25 21:31:47 +00:00
Barry Warsaw 4aab68e1c1 (py-execute-region): Alexander Schmolck points out that leading
whitespace can hose the needs-if test.  So just skip all blank lines
at the start of the region right off the bat.
2002-04-25 19:17:42 +00:00
Barry Warsaw 13caba30b8 (py-comint-output-filter-function): Add a pop-to-buffer call so you
always get to see the result of e.g. a py-execute-region.  Funny, this
bugged both me /and/ Guido!
2002-04-25 16:26:38 +00:00
Barry Warsaw 56bd2edeef (py-shell-hook): A new hook variable, run at the end of py-shell.
Allows for some customization of the underlying comint buffer.

(py-shell): Call the new hook.

(info-lookup-maybe-add-help): A new call suggested by Milan Zamazal to
make lookups in the Info documentation easier.
2002-04-25 15:44:17 +00:00
Guido van Rossum 256705bca7 SF patch 546244 by John Williams: add Text.dump() method. 2002-04-23 13:29:43 +00:00
Anthony Baxter 8388895fe4 SF patch [ 545523 ] patch for 514433 bsddb.dbopen (NULL)
closes SF #514433

can now pass 'None' as the filename for the bsddb.*open functions,
and you'll get an in-memory temporary store.

docs are ripped out of the bsddb dbopen man page. Fred may want to
clean them up.

Considering this for 2.2, but not 2.1.
2002-04-23 02:11:05 +00:00
Barry Warsaw 0494955b8f Merge in Skip's last few updates w.r.t. py-help-at-point:
(py-mode-map): Bind py-help-at-point to f1 as well as C-c C-h

(py-help-at-point): Make sure the symbol is quoted so things like
pydoc.help('sys.platform') work correctly.  Also, leave the *Python
Output* buffer in help-mode; this may be a bit more controversial.
2002-04-22 22:05:49 +00:00
Barry Warsaw 29a90f0a7a Some contributions and ideas by Alexander Schmolck: add a keybinding
to call pychecker on the current file, add a face for pseudo
keywords self, None, True, False, and Ellipsis.  Specifically,

(py-pychecker-command, py-pychecker-command-args): New variables.

(py-pseudo-keyword-face): New face variable, defaulting to a copy of
font-lock-keyword-face.

(python-font-lock-keywords): Add an entry for self, None, True, False,
Ellipsis to be rendered in py-pseudo-keyword-face.

(py-pychecker-history): New variable.

(py-mode-map): Bind C-c C-w to py-pychecker-run.

(py-pychecker-run): New command.
2002-04-22 21:48:20 +00:00
Barry Warsaw a7cc43b9e8 Skip Montanaro's contribution (slightly mod'd by Barry) to provide a
"help-on-symbol-at-point" feature which uses pydoc to provide help on
the symbol under point, if available.

Mods include some name changes, a port to Emacs, binding the command
to C-c C-h, and providing a more informative error message if the
symbol's help can't be found (through use of a nasty bare except).

Note also that py-describe-mode has been moved off of C-c C-h m; it's
now just available on C-c ?

Closes SF patch #545439.
2002-04-22 17:15:19 +00:00
Barry Warsaw a0113cd5cd (py-execute-region): If the line at the beginning of the region is a
#! line, use the command on that line as the shell command to use to
execute the region.  I.e. if the region looks like

----------------
#! /usr/bin/env python1.5

print 'hello world'.startswith('hello')
----------------

you'll get an exception! :)

This closes SF bug #232398.
2002-04-22 16:23:29 +00:00
Barry Warsaw b2d5e62d65 (py-execute-region): If you ran this without having visited a
python-mode file, py-which-shell would have been nil and the command
to use would not get set correctly.  This changes things so that 1)
the temporary file has a .py extension, 2) the temporary file is put
into python-mode, and 3) the temporary file's py-which-shell is
captured in a local `shell' variable, which is used to calculate the
command to use.  Closes SF bug #545436.

(py-parse-state): Rip out the XEmacs-specific calls to
buffer-syntactic-context, which can get quite confused if there's an
open paren in column zero say, embedded in a triple quoted string.
This was always a performance hack anyway, and computers are fast
enough now that we should be able to get away with the slower, more
portable, full-parse branch.  Closes SF bug #451841.

Update the comments at the top of the file.
2002-04-22 15:29:27 +00:00
Tim Peters 639295f0a5 Enable universal newlines on Windows. Note that NEWS needs more words! 2002-04-21 07:30:30 +00:00
Martin v. Löwis 6af3e2dc31 Forward port of patch # 500311: Work around for buggy https servers.
Fixes #494762.
2002-04-20 07:47:40 +00:00
Tim Peters 7d4ed0db95 Get the right funny characters in Hernan's name. 2002-04-19 15:59:01 +00:00
Marc-André Lemburg 1ec71ea48e Added note about new distutils commands. 2002-04-17 20:33:40 +00:00
Tim Peters 08e7295ef8 Windows installer: disabled Wise's "delete in-use files" uninstall
option.  It was the cause of at least one way UNWISE.EXE could vanish
(install a python; uninstall it; install it again; reboot the machine;
abracadabra the uinstaller is gone).

Bugfix candidate, but I'll backport it myself.
2002-04-16 20:48:01 +00:00
Walter Dörwald 068325ef92 Apply the second version of SF patch http://www.python.org/sf/536241
Add a method zfill to str, unicode and UserString and change
Lib/string.py accordingly.

This activates the zfill version in unicodeobject.c that was
commented out and implements the same in stringobject.c. It also
adds the test for unicode support in Lib/string.py back in and
uses repr() instead() of str() (as it was before Lib/string.py 1.62)
2002-04-15 13:36:47 +00:00
Guido van Rossum 862fe3c52e Add news about deprecated complex ops. 2002-04-15 12:36:47 +00:00
Guido van Rossum a3a4300fe0 Four more names for the hall of fame. 2002-04-15 01:05:01 +00:00
Martin v. Löwis 06a83e90aa Patch #543447: Add posix.mknod. 2002-04-14 10:19:44 +00:00
Guido van Rossum 4904204158 News for strip methods. 2002-04-13 00:59:05 +00:00
Neil Schemenauer 9344b14828 Add news about memory managent APIs changing. 2002-04-12 23:00:08 +00:00
Guido van Rossum c69343b69a News about dict.pop(). 2002-04-12 19:22:48 +00:00
Neal Norwitz 263ad28be9 Spell Raymond Hettinger's name write 2002-04-12 15:18:22 +00:00
Guido van Rossum b69844ff72 Add Raymond Hettinger, CPA. 2002-04-12 15:12:47 +00:00
Martin v. Löwis 688357e035 Patch #512005: getrusage() returns struct-like object. 2002-04-08 21:28:20 +00:00
Guido van Rossum 0986d8250f - A type can now inherit its metatype from its base type. Previously,
when PyType_Ready() was called, if ob_type was found to be NULL, it
  was always set to &PyType_Type; now it is set to base->ob_type,
  where base is tp_base, defaulting to &PyObject_Type.

- PyType_Ready() accidentally did not inherit tp_is_gc; now it does.

Bugfix candidate.
2002-04-08 01:38:42 +00:00
Guido van Rossum 8ace1ab53a - Changed new-style class instantiation so that when C's __new__
method returns something that's not a C instance, its __init__ is
  not called.  [SF bug #537450]
2002-04-06 01:05:01 +00:00
Guido van Rossum 181e41ad40 Some more news. 2002-04-06 00:23:25 +00:00
Marc-André Lemburg 4179a01bb7 Comment about UTF-16 changes. 2002-04-05 12:15:05 +00:00
Tim Peters 3318792e5f SF bug 497854: Short-cuts missing for All Users
Fix Windows-specific install glitch.  Tested on Win2K, but I can't test
on XP.
Already checked in to the release22-maint branch.
2002-04-04 20:02:04 +00:00
Fred Drake fed7e85791 Add note about changes in xml.sax.expatreader. 2002-04-04 19:36:15 +00:00
Guido van Rossum 2e1c09c1fd Removed old Digital Creations copyright/license notices (with
permission from Paul Everitt).  Also removed a few other references to
Digital Creations and changed the remaining ones to Zope Corporation.
2002-04-04 17:52:50 +00:00
Marc-André Lemburg 4626009493 Added note about updated freeze.py Tool. 2002-04-04 16:17:11 +00:00
Guido van Rossum 47834463d0 Add a note about bool. 2002-04-04 15:21:33 +00:00
Tim Peters 8deda70b16 Eliminate DONT_SHARE_SHORT_STRINGS. 2002-03-30 10:06:07 +00:00
Martin v. Löwis 1142de3f5b Patch #527027: Allow building python as shared library. 2002-03-29 16:28:31 +00:00
Tim Peters 1f7df3595a Remove the CACHE_HASH and INTERN_STRINGS preprocessor symbols. 2002-03-29 03:29:08 +00:00
Guido van Rossum 95b62a6dd4 News for SF #535905. 2002-03-29 01:07:24 +00:00
Martin v. Löwis 2e64c34850 Expose C library's gettext. Fixes #516412. 2002-03-27 18:49:02 +00:00
Neal Norwitz 0c766a0bb6 Change sys_exit to use METH_VARARGS.
sys.exit() now requires 0-1 arguments.  Previously 2+ arguments were allowed.
2002-03-27 13:03:09 +00:00
Neil Schemenauer 9d50d138e7 Add news about pymalloc being enabled. 2002-03-22 17:06:59 +00:00
Walter Dörwald b25c2b0a4a [Apply SF patch #504943]
This patch makes it possible to pass Warning instances as the first
argument to warnings.warn. In this case the category argument
will be ignored. The message text used will be str(warninginstance).
2002-03-21 10:38:40 +00:00
Barry Warsaw d164837856 (py-temp-directory): Add /var/tmp to the list of directories this
searches.  This is added after /tmp.  Closes SF bug #505488, except
that /var/tmp comes after /tmp instead of the patch's suggestion of
putting it before /usr/tmp.
2002-03-18 18:53:56 +00:00
Martin v. Löwis 5c137c2251 Patch #495598: add an -q (quiet) option to pycompile. 2002-03-18 12:44:08 +00:00
Martin v. Löwis 587c98c863 Patch #430706: Persistent connections in BaseHTTPServer. 2002-03-17 18:37:22 +00:00
Barry Warsaw d36cfe495e (py-honor-comment-indentation, py-compute-indentation): Fix the
implementation to match the documentation for
py-honor-comment-indentation w.r.t. not nil or t value.  In that case
it should still ignore ## for indentation purposes.  Closes SF bug
#523825, w/ patch provided by Christian Stork (mod'd by Barry).

Python 2.2.1 candidate.
2002-03-15 16:46:46 +00:00
Guido van Rossum 8c84255316 "Fix" for SF bug #520644: __slots__ are not pickled.
As promised in my response to the bug report, I'm not really fixing
it; in fact, one could argule over what the proper fix should do.
Instead, I'm adding a little magic that raises TypeError if you try to
pickle an instance of a class that has __slots__ but doesn't define or
override __getstate__.  This is done by adding a bozo __getstate__
that always raises TypeError.

Bugfix candidate (also the checkin to typeobject.c, of course).
2002-03-14 23:05:54 +00:00
Tim Peters fbf74f2acc News about zlib-1.1.4. 2002-03-14 19:06:01 +00:00
Tim Peters fb05db2cae file_truncate(): provide full "large file" support on Windows, by
dropping MS's inadequate _chsize() function.  This was inspired by
SF patch 498109 ("fileobject truncate support for win32"), which I
rejected.

libstdtypes.tex:  Someone who knows should update the availability
blurb.  For example, if it's available on Linux, it would be good to
say so.

test_largefile:  Uncommented the file.truncate() tests, and reworked to
do more.  The old comment about "permission errors" in the truncation
tests under Windows was almost certainly due to that the file wasn't open
for *write* access at this point, so of course MS wouldn't let you
truncate it.  I'd be appalled if a Unixish system did.

CAUTION:  Someone should run this test on Linux (etc) too.  The
truncation part was commented out before.  Note that test_largefile isn't
run by default.
2002-03-11 00:24:00 +00:00
Martin v. Löwis cfeb3b6ab8 Patch #50002: Display line information for bad \x escapes:
- recognize "SyntaxError"s by the print_file_and_line attribute.
- add the syntaxerror attributes to all exceptions in compile.c.
Fixes #221791
2002-03-03 21:30:27 +00:00
Guido van Rossum 2eb0b87d14 SF patch 514641 (Naofumi Honda) - Negative ob_size of LongObjects
Due to the bizarre definition of _PyLong_Copy(), creating an instance
of a subclass of long with a negative value could cause core dumps
later on.  Unfortunately it looks like the behavior of _PyLong_Copy()
is quite intentional, so the fix is more work than feels comfortable.

This fix is almost, but not quite, the code that Naofumi Honda added;
in addition, I added a test case.
2002-03-01 22:24:49 +00:00
Guido van Rossum 6f33250ef9 SF patch 517245 by Marc Recht.
Support GMP version >= 2.

Bugfix candidate.
2002-03-01 21:31:27 +00:00
Martin v. Löwis 29001ff234 Patch #523268, #522027: return enhanced tuples. 2002-03-01 10:47:37 +00:00
Martin v. Löwis 9986633609 Patch 520694: arraymodule.c improvements:
- make array.array a type
- add Py_UNICODE arrays
- support +=, *=
2002-03-01 10:27:01 +00:00
Guido van Rossum 88b666ca3f SF patch 518765 (Derek Harland): Bug in copy.py when used through
rexec.

When using a restricted environment, imports of copy will fail with an
AttributeError when trying to access types.CodeType.

Bugfix candidate (all the way back to 1.5.3, but at least 2.1.3 and
2.2.1).
2002-02-28 23:19:52 +00:00
Tim Peters e64ef931d6 SF patch 522961: Leak in Python/thread_nt.h, from Gerald S. Williams.
A file-static "threads" dict mapped thread IDs to Windows handles, but
was never referenced, and entries never got removed.  This gets rid of
the YAGNI-dict entirely.
Bugfix candidate.
2002-02-28 21:34:34 +00:00
Guido van Rossum bc64f7c6f3 Edward K. Ream. 2002-02-25 23:12:32 +00:00
Martin v. Löwis b2c92f44d4 Patch #511193: Implement killpg in posixmodule. 2002-02-16 23:35:41 +00:00
Marc-André Lemburg a5d2b4cb18 Break SSL support out of _socket module and place it into a new
helper module _ssl.

The support for the RAND_* APIs in _ssl is now only enabled
for OpenSSL 0.9.5 and up since they were added in that
release.

Note that socketmodule.* should really be renamed to _socket.* --
unfortunately, this seems to lose the CVS history of the file.

Please review and test... I was only able to test the header file
chaos in socketmodule.c/h on Linux. The test run through fine
and compiles don't give errors or warnings.

WARNING: This patch does *not* include changes to the various
non-Unix build process files.
2002-02-16 18:23:30 +00:00
Guido van Rossum ff34626a7e Remove stub for unicode.txt. Resort README in dictionary order. 2002-02-11 01:18:25 +00:00
Marc-André Lemburg 37aa580742 News about the new alias support. 2002-02-10 21:42:47 +00:00
Marc-André Lemburg e92e0a944e Add news about PYC magic and changes to UTF-8 codec. 2002-02-09 11:28:43 +00:00
Tim Peters ab034fab03 Implement os.waitpid() for Windows, in a way that's compatible with Linux
where their capabilities intersect.  Would be nice if people using non-
MSVC compilers (Borland etc) took a whack at doing something similar for
them (this code relies on the MS _cwait function).
2002-02-01 11:27:43 +00:00
Tim Peters 11bd9944e5 New tempfile and os.open() gimmicks for Windows. 2002-02-01 00:52:29 +00:00
Martin v. Löwis ef180dc3d0 Document that get_referrers can return unreachable but uncollected objects.
Fixes #505453.
2002-01-26 20:11:50 +00:00
Martin v. Löwis fb0da9d770 Test for error status of shl_findsym. Fixes #505417. 2.2.1 candiate. 2002-01-26 20:03:48 +00:00
Thomas Heller d45a543418 Another name. 2002-01-18 20:56:28 +00:00
Martin v. Löwis 9668b933e3 Patch #414775: Add --skip-build option to bdist command. 2002-01-12 11:27:42 +00:00
Martin v. Löwis a55ffaeee9 Add a per-message fallback mechanism for translations. 2002-01-11 06:58:49 +00:00
Martin v. Löwis 1be6419871 Add fallback argument to translation(). Request fallbacks on install.
Fixes #500595.
2002-01-11 06:33:28 +00:00
Fred Drake 3673612754 Added item about the webbrowser security fix. 2002-01-10 13:50:31 +00:00
Marc-André Lemburg 3e3eacb5fc Fixed "u#" parser marker to pass through Unicode objects as-is without
going through the buffer interface API.

Added tests for this to the _testcapi module and updated docs.
2002-01-09 16:21:27 +00:00
Guido van Rossum 23105d5c24 Checked in Sean Reifschneider's RPM spec file and patches. Bugfix candidate. 2002-01-06 03:29:16 +00:00
Neal Norwitz e790eae7cf Improve grammar 2002-01-01 21:14:12 +00:00
Martin v. Löwis 93227275dc Patch #497126: Always compile dl. 2002-01-01 20:18:30 +00:00
Martin v. Löwis 7198a525f3 Patch #494783: Rename cmp_op enumerators. 2002-01-01 19:59:11 +00:00
Neal Norwitz 649b75954a SF Patch #494863, file.xreadlines() should raise ValueError if file is closed
This makes xreadlines behave like all other file methods
(other than close() which just returns).
2002-01-01 19:07:13 +00:00
Martin v. Löwis a6e975801e Patch #497098: build support for GNU/Hurd. 2002-01-01 18:41:33 +00:00
Guido van Rossum 606fe4e79f SF patch #497420 (Eduardo Pérez): ftplib: ftp anonymous password
Instead of sending the real user and host, use "anonymous@" (i.e. no
host name at all!) as the default anonymous FTP password.  This avoids
privacy violations.
2001-12-28 20:57:14 +00:00
Guido van Rossum c33e077838 SF patch #497420 (Eduardo Pérez): ftplib: ftp anonymous password
Instead of sending the real user and host, use "anonymous@" (i.e. no
host name at all!) as the default anonymous FTP password.  This avoids
privacy violations.
2001-12-28 20:54:28 +00:00
Jack Jansen 5560269675 Added someone. 2001-12-27 23:37:49 +00:00