Guido van Rossum [Mon, 24 Nov 1997 17:36:21 +0000 (17:36 +0000)]
Change the option used on Linux to export all symbols
from the main program to shared libraries. On mklinux, the old
'-rdynamic' doesn't work; the new '-Xlinker -export-dynamic' works
both there and on Intel Linux platforms.
Barry Warsaw [Thu, 20 Nov 1997 19:56:38 +0000 (19:56 +0000)]
(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.
Guido van Rossum [Wed, 19 Nov 1997 19:01:43 +0000 (19:01 +0000)]
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.
Guido van Rossum [Wed, 19 Nov 1997 18:53:33 +0000 (18:53 +0000)]
Fix importing of shared libraries from inside packages.
This is a bit of a hack: when the shared library is loaded, the module
name is "package.module", but the module calls Py_InitModule*() with just
"module" for the name. The shared library loader squirrels away the true
name of the module in _Py_PackageContext, and Py_InitModule*() will
substitute this (if the name actually matches).
Guido van Rossum [Wed, 19 Nov 1997 16:15:37 +0000 (16:15 +0000)]
Two changes (here we go again :-( ).
1) The __builtins__ variable in the __main__ module is set to the
__builtin__ module instead of its __dict__.
2) Get rid of the SIGHUP and SIGTERM handlers. They can't be made to
work reliably when threads may be in use, they are Unix specific, and
Python programmers can now program this functionality is a safer way
using the signal module.
Guido van Rossum [Wed, 19 Nov 1997 16:03:17 +0000 (16:03 +0000)]
Add a new function PyNumber_CoerceEx() which works just like
PyNumber_Coerce() except that when the coercion can't be done and no
other exceptions happen, it returns 1 instead of raising an
exception.
Use this function in PyObject_Compare() to avoid raising an exception
simply because two objects with numeric behavior can't be coerced to a
common type; instead, proceed with the non-numeric default comparison.
Note that this is a somewhat questionable practice -- comparisons for
numeric objects shouldn't default to random behavior like this, but it
is required for backward compatibility. (Case in point, it broke
comparison of kjDict objects to integers in Aaron Watters' kjbuckets
extension.) A correct fix (for python 2.0) should involve a different
definiton of comparison altogether.
Guido van Rossum [Tue, 18 Nov 1997 19:23:07 +0000 (19:23 +0000)]
Undo another glitch of the automatic not-so-Grand Renaming; some local
variables called 'coerce' were accidentally renamed to
'PyNumber_Coerce'. Rename them back to coercefunc.
Guido van Rossum [Fri, 14 Nov 1997 22:24:28 +0000 (22:24 +0000)]
This fix (across 4 files in 3 directories) solves a subtle problem with
signal handlers in a fork()ed child process when Python is compiled with
thread support. The bug was reported by Scott <scott@chronis.icgroup.com>.
What happens is that after a fork(), the variables used by the signal
module to determine whether this is the main thread or not are bogus,
and it decides that no thread is the main thread, so no signals will
be delivered.
The solution is the addition of PyOS_AfterFork(), which fixes the signal
module's variables. A dummy version of the function is present in the
intrcheck.c source file which is linked when the signal module is not
used.
Guido van Rossum [Tue, 11 Nov 1997 18:29:22 +0000 (18:29 +0000)]
Suggestion by David Ascher: set EXE macro to empty string and use it
in a few places -- so it can be set to .exe on GNUWIN32 platforms and
do the right thing. Whatever. (This was already done in
Modules/Makefile* but wasn't carried over here.)
Guido van Rossum [Tue, 11 Nov 1997 17:18:48 +0000 (17:18 +0000)]
Use a %s format for the exit status -- through the magical workings of
the aptly named MagicDict class, the value is a string, not a number,
by the time it is printed...
All geometry manager methods that apply to a master widget instead of
to a slave widget have been moved to the Misc class, which is
inherited by all of Tk(), Toplevel() and Widget(). They have been
renamed to have their geometry manager name as a prefix,
e.g. pack_propagate(); the short names can still be used where
ambiguities are resolved so that pack has priority over place has
priority over grid (since this was the old rule).
Also, the method definitions in the Pack, Place and Grid classes now
all have their respective geometry manager name as a prefix
(e.g. pack_configure); the shorter names are aliases defined through
assignment.
A similar renaming has been done for all config() methods found
elsewhere; these have been renamed to configure() with config being
the alias (instead of the other way around). (This may not make much
of a difference but the official Tk command name is now 'configure'
and it may help in debugging tracebacks.)
Finally, a new base class BaseWidget has been introduced, which
implements the methods common between Widget and Toplevel (the
difference between those two classes is that Toplevel has a different
__init__() but also that Toplevel doesn't inherit from Pack, Place or
Grid.
Fix problem discovered by Barry: if you hit ^C to
sys.stdin.readline(), you get a fatal error (no current thread). This
is because there was a call to PyErr_CheckSignals() while there was no
current thread. I wonder how many more of these we find... I bnetter
go hunting for PyErr_CheckSignals() now...
Separate out a function pystones(loops=LOOPS) which runs the benchmark
and returns a (benchtime, stones) tuple. The main() function now
calls this and prints the report. Fred Drake's code.
Barry Warsaw [Thu, 6 Nov 1997 14:35:15 +0000 (14:35 +0000)]
(python-font-lock-keywords): Pick up block introducing keywords with
immediately following colons. Sjoerd noticed this one too. Here's a
nonsense.py file that flexes all the font-lock keyword combinations.
class A:
class B(A):
pass
def __init__(self):
if i == 2 and j == 3 or k == 4:
import stuff
from otherstuff import cool
for i in range(cool.count):
if i == j:
break
elif j == 1:
continue
print i
else:
return not i
elif q is not i:
return lambda x: x + 1
else:
try:
try:
raise stuff.error
except stuff.error, v:
print v
except:
global q
finally:
while q > 0:
q = q - 1
assert q == 0
Barry Warsaw [Wed, 5 Nov 1997 18:41:11 +0000 (18:41 +0000)]
(py-emacs-features): Test for working make-temp-name, which is broken
on NTEmacs 19.34.6.
(py-serial-number): New variable.
(py-execute-region): If make-temp-name is broken, simply append a
serial number to the string "python-" to get a temporary file name.
It's possible concurrent NTEmacs can step on each others toes, but it
makes no sense to further coddle a busted NTEmacs.
Barry Warsaw [Wed, 5 Nov 1997 00:51:08 +0000 (00:51 +0000)]
(mark-python-def-or-class): Renamed to py-mark-def-or-class globally.
(py-mode-map): Moved py-mark-def-or-class from M-C-h to C-c C-m since
the old binding conflicts with the standard global backward-kill-word
binding, and this new binding is more conformant with other language
modes. Moved py-mark-block to C-c C-k.
Setting interp->builtins to the __builtin__ module instead of to its
dictionary had the unfortunate side effect of always running in
restricted execution mode :-(
I will check in a different way of setting __main__.__builtins__ to
the __builtin__ module later.
Also, there was a typo -- a comment was unfinished, and as a result
some finalizations were not being executed.
In Bart Simpson style,
I Will Not Check In Untested Changes.
I Will Not Check In Untested Changes.
I Will Not Check In Untested Changes.
I Will Not Check In Untested Changes.
I Will Not Check In Untested Changes.
I Will Not Check In Untested Changes.
I Will Not Check In Untested Changes.
I Will Not Check In Untested Changes.
I Will Not Check In Untested Changes.
I Will Not Check In Untested Changes.
Barry Warsaw [Tue, 4 Nov 1997 19:21:50 +0000 (19:21 +0000)]
(py-backspace-function): New variable.
(py-electric-backspace, py-electric-delete): Support the XEmacs 20 Way
for backspace and delete mappings. In XEmacs 19, Emacs 19, and Emacs
20, both backspace and delete keysyms are bound to
py-electric-backspace. In XEmacs 20, backspace and delete keysyms are
bound separately, allowing the user to specify forward or backward
deletion of the delete keysym through the variable
delete-key-deletes-forward. All this is the Right Way To Do It and
this implementation was largely ripped from CC Mode.
Barry Warsaw [Tue, 4 Nov 1997 18:47:06 +0000 (18:47 +0000)]
First round of changes, mostly subprocess stuff.
(py-execute-file): Better interaction with comint. Set
comint-scroll-to-bottom-on-output to t. Wrapper buffer change in
unwind-protect in case process filter fails.
(py-shell): Start Python with -i flag to fix tty problem on Windows;
presumably -- not yet tested.
(py-clear-queue): New function to clear the pending exec file queue.
Not currently keybound.
(py-execute-region, py-execute-buffer): Added optional async flag (use
via C-u prefix) to execute the region in a new asynchrous buffer, even
if the Python shell is running.
(py-append-to-process-buffer): Removed as obsolete. Comint provides
this functionality.
Removed fbound test defun of match-string. All modern X/Emacsen have
this function.
When checking for equality, open the slave file in text mode so it
will compare equal even if the master file uses only \n to terminate
lines (this is by far the most common situation). Also, check for the
case where the master file is missing, and print the time difference
in seconds when the slave file appears newer than the master (for
debugging).
Use ``0'' instead of ``None'' to reset the underlying object in close
methods. Using None causes problems if the destructor is called after
the __builtin__ module has already been destroyed (unfortunately, this
can happen!). I can't just delete the object because it is actually
tested for (if self._sock: ...). Setting it to 0 is a bit weird but
works.
Get rid of another reference to _PyImport_Inittab (now a static array)
that should be PyImport_Inittab (a new pointer initialized to point to
the array).
Move the Py_{{BEGIN,END}_ALLOW,BLOCK}_THREADS macros in time_sleep()
to inside floatsleep(). This is necessary because floatsleep() does
the error handling and it must have grabbed the interpreter lock and
thread state before it can do so.
- The interp->builtins variable (and hence, __main__.__builtins__) is
once again initialized to the built-in *module* instead of its
dictionary.
- The finalization order is once again changed. Signals are finalized
relatively early, because (1) it DECREF's the signal handlers, and if
a signal handler happens to be a bound method, deleting it could cause
problems when there's no current thread around, and (2) we don't want
to risk executing signal handlers during finalization.