Commit Graph

1023 Commits

Author SHA1 Message Date
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