Commit Graph

576 Commits

Author SHA1 Message Date
Guido van Rossum
bc2472db8e Avoid some potential (though unlikely) sprintf buffer overflows. 1997-04-30 19:07:54 +00:00
Guido van Rossum
15e33a4c42 Avoid sprintf buffer overflow if more than 9999 arguments. 1997-04-30 19:00:27 +00:00
Guido van Rossum
d11bfdd9f5 Ugly hack for SGI IRIX 6.2. Apparently _POSIX_THREADS is defined even
when the pthread package is not installed.  configure knows better, so
#undef _POSIX_THREADS when pthread.h does not exist.
1997-04-29 21:48:34 +00:00
Guido van Rossum
bb5c6f8529 Oops, forgot one: inittab. 1997-04-29 20:42:30 +00:00
Guido van Rossum
0bac33b420 Oops, forgot one: inittab. 1997-04-29 20:24:10 +00:00
Guido van Rossum
79f25d9a7b Quickly renamed the remaining files -- this directory is done. 1997-04-29 20:08:16 +00:00
Guido van Rossum
65bf9f265e Quickly renamed. 1997-04-29 18:33:38 +00:00
Guido van Rossum
373c869a6a Quickly renamed. Also removed the long comment explaining why this is
better than the old error API.
1997-04-29 18:22:47 +00:00
Guido van Rossum
b209a116cf Quickly renamed. 1997-04-29 18:18:01 +00:00
Guido van Rossum
62cb0bafe2 Moved to ../Modules. 1997-04-29 15:50:32 +00:00
Guido van Rossum
58a6ac55d2 Removed cgensupport.[co] (to ../Modules). 1997-04-29 15:42:53 +00:00
Guido van Rossum
c474deaaf6 Expand one level of symbolic link in sys.argv[0] before inserting its
dirname in sys.path.  This means that you can create a symbolic link
foo in /usr/local/bin pointing to /usr/yourname/src/foo/foo.py, and
then invoking foo will insert /usr/yourname/src/foo in sys.path, not
/usr/local/bin.  This makes it easier to have multifile programs
(before, the program would have to do an os.readlink(sys.argv[0])
itself and insert the resulting directory in sys.path -- Grail does
this).

Note that the expansion is only used for sys.path; sys.argv[0] is
still the original, unadorned filename (/usr/local/bin/foo in the
example).
1997-04-25 15:38:31 +00:00
Guido van Rossum
03a7466b8f OK, ready to make 'assert' a keyword (instead of '__assert__'). 1997-04-16 00:34:46 +00:00
Guido van Rossum
7844e38a98 Keep Microsoft VC happy. 1997-04-11 20:44:04 +00:00
Guido van Rossum
6bf62dad9e Keep gcc -Wall and Microsoft VC happy. 1997-04-11 20:37:35 +00:00
Guido van Rossum
1d2e240954 (Jack:) On the Mac, don't automatically enable dynamic loading. 1997-04-11 19:22:06 +00:00
Guido van Rossum
62bf108392 (Jack:) Don't define TRUE and FALSE if already defined. 1997-04-11 19:19:46 +00:00
Guido van Rossum
6976a52099 (Jack:) On the Mac, use standard strerror() if using MSL C-library. 1997-04-11 19:18:23 +00:00
Guido van Rossum
644a12b00c Tweaks to keep the Microsoft compiler quier. 1997-04-09 19:24:53 +00:00
Guido van Rossum
5f5e817e00 Support for alternative string quotes (a"xx", b"xx", c"xx", ...).
In interactive mode, do generate code for single-string statements.
1997-04-06 03:41:40 +00:00
Guido van Rossum
2a7f58de1c Allow passing a .pyo file.
Print correct name in fatal error from PyErr_Print.
1997-04-02 05:28:38 +00:00
Guido van Rossum
228d7f3f67 Added assert statement. 1997-04-02 05:24:36 +00:00
Guido van Rossum
8ecd1ad785 Added assert grammar. 1997-04-02 05:24:08 +00:00
Guido van Rossum
c6472e9ee1 1. Add string conversions to int(), long(), float(). (Not to complex()!)
2. Fix two bugs in complex():

   - Memory leak when using complex(classinstance) -- r was never
   DECREF'ed.

   - Conversion of the second argument, if not complex, was done using
   the type vector of the 1st.
1997-03-31 17:15:43 +00:00
Guido van Rossum
45b83915f8 New form of PyFPE_END_PROTECT macro. 1997-03-14 04:32:50 +00:00
Guido van Rossum
6af0c00ab6 Fix dumb bug calling parsestrplus with wrong node as argument.
Add prototypes for parsestr() and parsestrplus() (unrelated, but
seemed to make sense.)
1997-03-11 21:25:55 +00:00
Guido van Rossum
1c6a459921 Define __debug__ as 0 if -O is given, 1 otherwise. Also test for
errors in initializing the dictionary.
1997-03-11 18:43:26 +00:00
Guido van Rossum
7c53111d5b Added support for ``if __debug__:'' -- if -O is given, this form is
recognized by the code generator and code generation for the test and
the subsequent suite is suppressed.

One must write *exactly* ``if __debug__:'' or ``elif __debug__:'' --
no parentheses or operators must be present, or the optimization is
not carried through.  Whitespace doesn't matter.  Other uses of
__debug__ will find __debug__ defined as 0 or 1 in the __builtin__
module.
1997-03-11 18:42:21 +00:00
Guido van Rossum
0824f63cfc When -O is given, use ".pyo" instead of ".pyc". 1997-03-11 18:37:35 +00:00
Guido van Rossum
c43b685054 Clarify error message for unexpected keyword parameter. 1997-03-10 22:58:23 +00:00
Guido van Rossum
82598051e6 Greatly renamed. Not a very thorough job -- I'm going to restructure
it anyway.
1997-03-05 00:20:32 +00:00
Guido van Rossum
8e793d925c Add global Py_OptimizeFlag. SET_LINENO is omitted again unless this is
nonzero.
1997-03-03 19:13:14 +00:00
Guido van Rossum
0ae748d3c4 Changes for Lee Busby's SIGFPE patch set.
New file pyfpe.c and exception FloatingPointError.
Surround some f.p. operations with PyFPE macro brackets.
1997-02-14 22:58:07 +00:00
Guido van Rossum
0f4bbd2f34 Keep gcc -Wall happy. 1997-02-14 21:12:56 +00:00
Guido van Rossum
2dc466169e Oops, remove an unused variable from PyErr_Format(). 1997-02-14 20:57:31 +00:00
Guido van Rossum
7433b12a5c Added new global flag variable Py_InteractiveFlag and new function
Py_FdIsInteractive().  The flag is supposed to be set by the -i
command line option.  The function is supposed to be called instead of
isatty().  This is used for Lee Busby's wish #1, to have an option
that pretends stdin is interactive even when it really isn't.
1997-02-14 19:45:36 +00:00
Guido van Rossum
1548bacb14 Added convenience function PyErr_Format(exception, formatstring, ...) -> NULL. 1997-02-14 17:09:47 +00:00
Guido van Rossum
0d85be19e2 *Don't* kill all local variables on function exit. This will be done
by the frameobject dealloc when it is time for the locals to go.  When
there's still a traceback object referencing this stack frame, we
don't want the local variables to disappear yet.

(Hmm...  Shouldn't they be copied to the f_locals dictionary?)
1997-02-14 16:32:14 +00:00
Guido van Rossum
e8811f85ed Added intern() function. 1997-02-14 15:48:05 +00:00
Guido van Rossum
deb0c5e66c Two small changes:
- Use co->... instead of f->f_code->...; save an extra lookup of what
we already have in a local variable).

- Remove test for nlocals > 0 before setting fastlocals to
f->f_localsplus; 0 is a rare case and the assignment is safe even
then.
1997-01-27 23:42:36 +00:00
Guido van Rossum
d0eb429b88 Plug a leak with calling something other than a function or method is
called with keyword arguments -- the keyword and value were leaked.
This affected for instance with a __call__() method.

Bug reported and fix supplied by Jim Fulton.
1997-01-27 21:30:09 +00:00
Guido van Rossum
950361c6ca Patches for (two forms of) optional dynamic execution profiling --
i.e., counting opcode frequencies, or (with DXPAIRS defined) opcode
pair frequencies.  Define DYNAMIC_EXECUTION_PROFILE on the command
line (for this file and for sysmodule.c) to enable.
1997-01-24 13:49:28 +00:00
Guido van Rossum
8c5df06ec7 Change the control flow for error handling in the function prelude to
jump to the "Kill locals" section at the end.  Add #ifdef macintosh
bandaid to make sure we call sigcheck() on the Mac.
1997-01-24 04:19:24 +00:00
Guido van Rossum
43f1b8d6e4 Added optional interface for dynamic execution profile (to be gathered
in ceval.c).
1997-01-24 04:07:45 +00:00
Guido van Rossum
b3f515af64 Get the line number from PyCode_Addr2Line instead of believing
tb_lineno.  Store it in tb_lineno for the user.
1997-01-24 04:02:55 +00:00
Guido van Rossum
99d182550b New magin number (because of linenumber table). 1997-01-24 03:44:53 +00:00
Guido van Rossum
d031c89891 Marshal the line number table of code objects. 1997-01-24 03:44:17 +00:00
Guido van Rossum
da4eb5c3b5 Instead of emitting SET_LINENO instructions, generate a line number
table which is incorporated in the code object.  This way, the runtime
overhead to keep track of line numbers is only incurred when an
exception has to be reported.
1997-01-24 03:43:35 +00:00
Guido van Rossum
a4240132ec Kill all local variables on function return. This closes a gigantic
leak of memory and file descriptors (thanks for Roj for reporting
that!).  Alas, the speed goes down by 5%. :-(
1997-01-21 21:18:36 +00:00
Guido van Rossum
70d44787a3 Only call sigcheck() at the ticker code if we don't have true signals.
This is safe now that both intrcheck() and signalmodule.c schedule a
sigcheck() call via Py_AddPendingCall().

This gives another 7% speedup (never run such a test twice ;-).
1997-01-21 06:15:24 +00:00