Commit Graph

630 Commits

Author SHA1 Message Date
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
Guido van Rossum 1aa14838d2 Cleanup:
- fix bug in Py_MakePendingCalls() with threading
- fix return type of do_raise
- remove build_slice (same as PySlice_New)
- remove code inside #if 0
- remove code inside #ifdef CHECK_STACK
- remove code inside #ifdef SUPPORT_OBSOLETE_ACCESS
- comment about newimp.py should refer to ni.py
1997-01-21 05:34:20 +00:00
Guido van Rossum 554fa49500 get build info from elsewhere 1997-01-20 18:34:55 +00:00
Guido van Rossum 768360243a Changes for frame object speedup:
- get fastlocals differently
- call newframeobject() with fewer arguments
- toss getowner(), which was unused anyway
1997-01-20 04:26:20 +00:00
Guido van Rossum 7eb883a18e Remove unused variable. 1997-01-18 20:04:05 +00:00
Guido van Rossum 8d75161671 Intern the string "__complex__". 1997-01-18 08:04:16 +00:00
Guido van Rossum 7b89b6a660 Intern all names and varnames in newcodeobject(), plus those string
literals that look like identifiers.  Also intern all strings used as
names during the compilation.
1997-01-18 08:02:57 +00:00
Guido van Rossum 3dfd53b4c8 Add "if (x != NULL) continue;" (or similar for err==0) before the
break to most cases, as suggested by Tim Peters.  This gives another
8-10% speedup.
1997-01-18 02:46:13 +00:00
Guido van Rossum 98a9b312e8 Marshal the new stacksize item in code objects. 1997-01-17 21:07:08 +00:00
Guido van Rossum 7af8130857 Working semaphore implementation by Sjoerd. 1997-01-17 21:06:41 +00:00
Guido van Rossum dd5db43905 New MAGIC number (code objects have one more item when marshalled). 1997-01-17 21:06:11 +00:00
Guido van Rossum 62f7d15d0b Use the stack size from the code object and the CO_MAXBLOCKS constant
from compile.h.  Remove all eval stack overflow checks.
1997-01-17 21:05:28 +00:00
Guido van Rossum 8b993a98db Add co_stacksize field to codeobject structure, and stacksize argument
to PyCode_New() argument list.  Move MAXBLOCKS constant to conpile.h.

Added accurate calculation of the actual stack size needed by the
generated code.

Also commented out all fprintf statements (except for a new one to
diagnose stack underflow, and one in #ifdef'ed out code), and added
some new TO DO suggestions (now that the stacksize is taken of the TO
DO list).
1997-01-17 21:04:03 +00:00
Guido van Rossum 635abd24f0 Check for duplicate keyword arguments at compile time. 1997-01-06 22:56:52 +00:00
Guido van Rossum 8f49e12a0e Make builtin_module_names a tuple instead of a list. 1997-01-06 22:55:54 +00:00
Guido van Rossum 408027ea46 Rename DEBUG macro to Py_DEBUG 1996-12-30 16:17:54 +00:00
Guido van Rossum 0aa9ee65ab Moved the raise logic out of the main interpreter loop to a separate function.
The raise logic has one additional feature: if you raise <class>,
<value> where <value> is not an instance, it will construct an
instance using <value> as argument.  If <value> is None, <class> is
instantiated without arguments.  If <value> is a tuple, it is used as
the argument list.

This feature is intended to make it easier to upgrade code from using
string exceptions to using class exceptions; without this feature,
you'd have to change every raise statement from ``raise X'' to ``raise
X()'' and from ``raise X, y'' to ``raise X(y)''.  The latter is still
the recommended form (because it has no ambiguities about the number
of arguments), but this change makes the transition less painful.
1996-12-10 18:07:35 +00:00
Guido van Rossum c1547d930f Better way to handle 64-bit ints, keeping gcc -Wall happy.
Tested with AMK's help.
1996-12-10 15:39:04 +00:00
Guido van Rossum 1a2c5cbcc4 Add unistd.h to make gcc -Wall happy. 1996-12-10 15:37:36 +00:00
Guido van Rossum 067998f35e Add const to error and newstring functions 1996-12-10 15:33:34 +00:00
Guido van Rossum 80bb9655f0 Keep gcc -Wall happy. 1996-12-05 23:27:02 +00:00
Guido van Rossum ed0af8fe70 Support __complex__ method on instances, for complex() conversion.
Keep gcc -Wall happy.
1996-12-05 23:18:18 +00:00
Guido van Rossum 150b2df682 Change the Don Beaudry hack into the Don B + Jim F hack; now, if *any*
base class is special it gets invoked.

Make gcc -Wall happy.
1996-12-05 23:17:11 +00:00
Guido van Rossum 3afb5959aa Some extra flags that an HPUX user wants me to add. 1996-12-05 23:15:35 +00:00
Guido van Rossum b0c168cbe8 Tentative changes to make this work better on 64-bit machines.
A plain int that doesn't fit in 32 bits will be marshalled using a new
type.  32 bits machines can't handle this and will issue a warning.
1996-12-05 23:15:02 +00:00
Guido van Rossum d266eb460e New permission notice, includes CNRI. 1996-10-25 14:44:06 +00:00
Guido van Rossum b75fba04c7 Forget about Ellipses b/w compatibility. 1996-10-16 04:18:36 +00:00
Guido van Rossum e449af7da9 Ellipses -> Ellipsis rename (the dictionary really says that it should
be Ellipsis!).
Bumped the API version because a linker-visible symbol is affected.
Old C code will still compile -- there's a b/w compat macro.
Similarly, old Python code will still run, builtin exports both
Ellipses and Ellipsis.
1996-10-11 16:25:41 +00:00
Guido van Rossum cf1474b73a Sjoerd's thread changes (including down_sema typo fix).
Note: waitflag not supported on NT.
1996-10-08 14:17:53 +00:00
Guido van Rossum 452a9833c9 Added line number to most compile-time error messages. 1996-09-17 14:32:04 +00:00
Guido van Rossum 9b38a145e2 Rationalized MS ifdefs 1996-09-11 23:12:24 +00:00
Guido van Rossum cc88341e6d Changes to setpythonpath():
Test for / as well as for SEP for MS filenames.
Drop trailing separator from sys.path[0] for MS and Unix filenames.
1996-09-10 14:44:21 +00:00
Guido van Rossum b072150d7f Stupid bug: complex(x,y) would yield x+xj 1996-09-07 15:55:27 +00:00
Guido van Rossum 57b1822459 *** empty log message *** 1996-08-29 18:10:41 +00:00
Guido van Rossum 927f6e68fb Needed more includes... 1996-08-29 18:10:30 +00:00
Guido van Rossum bae29713ec *** empty log message *** 1996-08-29 17:48:26 +00:00
Guido van Rossum 6eea32622c typo (#indef -> #undef) 1996-08-26 14:58:54 +00:00
Guido van Rossum d8a6d1c2e7 Afterthough: leave both leading underscores in,
so __spam becomes _ClassName__spam.
1996-08-24 07:54:27 +00:00
Guido van Rossum fe2236f3c8 Oops need to mangle global statement separately 1996-08-24 07:29:04 +00:00
Guido van Rossum 8ff077b094 Name mangling, what the heck! 1996-08-24 06:21:31 +00:00
Guido van Rossum 8b9ea873ad Use MS_DLL_ID as sys.winver 1996-08-23 18:14:47 +00:00
Guido van Rossum ac279109d4 PYTHONWIN -> MS_COREDLL 1996-08-22 23:10:58 +00:00
Guido van Rossum c1d5053882 Add needed #include <ctype.h> 1996-08-21 23:38:24 +00:00
Guido van Rossum f1d7413445 Add explicit #undef _POSIX_THREADS for use on Solaris 2.5 (Sjoerd). 1996-08-21 14:39:29 +00:00
Guido van Rossum 504f4a9901 Don't require <dlfcn.h> -- rely on existence of dlopen(). 1996-08-20 19:59:07 +00:00
Guido van Rossum 7cf1fcf347 Always include config.h 1996-08-19 22:12:39 +00:00
Guido van Rossum 1e6124902a Many little fixes:
- support for SCO_SV dynamic loading
- on Mac, auto-detect dynamic loading by __CFM68K__ or _powerc)
- on Mac, long shared library extension is .cfm68k.slb or .ppc.slb
- on hp, don't redefine hpux if already defined
- add __file__ property to successfully loaded module
1996-08-19 22:12:10 +00:00
Guido van Rossum 71bd363d9c getprogramname -> Py_GetProgramName. 1996-08-19 22:09:38 +00:00
Guido van Rossum 6d43c5de5a Raise TypeError, not KeyError, on unknown keyword argument. 1996-08-19 22:09:16 +00:00
Guido van Rossum 3f3bb3d3c9 Added *PyMarshal_WriteObjectToString() (moved the relevant code there
from marshal_loads()).
1996-08-19 22:07:17 +00:00
Guido van Rossum aa35465ccf Support for keyword arguments (PyArg_ParseTupleAndKeywords) donated by
Geoff Philbrick <philbric@delphi.hks.com> (slightly changed by me).

Also a little change to make the file acceptable to K&R C compilers
(HPUX, SunOS 4.x).
1996-08-19 19:32:04 +00:00
Guido van Rossum bf51afa049 Don't test here for negative number to float power; that belongs in
floatobject.c.
1996-08-16 20:49:17 +00:00
Guido van Rossum 79d96d6bff Don't die in resizestring() on filter(<func>, ""). 1996-08-16 20:44:34 +00:00
Guido van Rossum 0dfcf753ad Disable support for access statement 1996-08-12 22:00:53 +00:00
Guido van Rossum 0bbf253e97 Insert "./" in front of pathname when it contains no '/' (if USE_SHLIB) 1996-08-09 20:55:05 +00:00
Guido van Rossum 1a62311cfb Changes necessary for AIX. 1996-08-08 18:53:41 +00:00
Guido van Rossum 1741d60725 Added casts from unsigned char to char when calling rds_object() on
frozen code.
1996-08-08 18:52:59 +00:00
Guido van Rossum 15cc9a0a76 Removed unused var; added error check for ``lambda: x=1''. 1996-08-08 18:51:04 +00:00
Guido van Rossum fe4b6ee775 Include mymath.h instead of declaring prototypes for math functions.
Fix leak and unchecked error in complex().
1996-08-08 18:49:41 +00:00
Guido van Rossum 9caf77a485 Put definition of _REENTRANT in config.h 1996-08-01 00:52:26 +00:00
Guido van Rossum d5962adb44 Changes for AIX sharedlibs. 1996-07-31 22:44:53 +00:00
Guido van Rossum 3823420ca4 If NO_DYNAMIC_LINK is defined, load_dynamic_module() will always fail. 1996-07-31 17:55:19 +00:00
Guido van Rossum 5e41644ddd Added _REENTRANT definition 1996-07-31 17:52:04 +00:00
Guido van Rossum 94a9667f1a Always insert script directory in front of sys.path -- if there's no
sys.argv, insert "".  Note that "." is removed as a default component
of the path (see changes to getpath.c and Setup.in).
1996-07-30 20:35:50 +00:00
Guido van Rossum 3b9c6677f8 Better error message if stride used on normal sequence object 1996-07-30 18:40:29 +00:00
Guido van Rossum 6ffd553899 Add 'Ellipses' object. 1996-07-30 18:37:55 +00:00
Guido van Rossum 8861b74445 Changes for slice and ellipses 1996-07-30 16:49:37 +00:00
Guido van Rossum 3ecebf1732 Changes needed by NeXT (the only platform that seems to use this). 1996-07-30 16:48:31 +00:00
Guido van Rossum a63d9f4d9f As a side effect of calling PySys_SetArgv (setpythonargv), the
directory containing argv[0] is inserted in front of sys.path.
If argv[0] contains no directory, an empty string is inserted.
If argv is empty, nothing happens.
1996-07-24 01:31:37 +00:00
Guido van Rossum 42cd305b25 new .pyc magic number (** operator) 1996-07-21 02:28:18 +00:00
Guido van Rossum 7cffd1322b added 1996 1996-07-21 02:28:11 +00:00
Guido van Rossum 530956d247 Py_complex; and WITHOUT_COMPLEX added to getargs.c 1996-07-21 02:27:43 +00:00
Guido van Rossum 6f489d989d Slightly different Windows ifdefs 1996-06-28 20:15:15 +00:00
Guido van Rossum 236f62da7a Corrections to aix_loaderror(), by Manus Hand. 1996-06-26 21:07:08 +00:00
Guido van Rossum f21506076d Jeremy's patches for more robust handling of unmarshallable types. 1996-06-26 20:41:23 +00:00
Guido van Rossum 0e41c8c848 Cosmetic change to the dox_8x3 hack. 1996-06-20 14:18:34 +00:00
Guido van Rossum 3b4da59cd6 Renamed static pow() to powerop() to avoid name conflict in some compilers. 1996-06-19 21:49:17 +00:00
Guido van Rossum 7c46a920ae New style interface via pointer variable. 1996-06-17 17:07:23 +00:00
Guido van Rossum cfd0a22252 struct frozen is now struct _frozen and comes from import.h. 1996-06-17 17:06:34 +00:00
Guido van Rossum 8fa9b6f932 Define sys.prefix and sys.exec_prefix (see Modules/getpath.c; from Makefile). 1996-06-17 17:02:48 +00:00
Guido van Rossum 6602099e7c Got rid of florida hack and made it work with Solaris 2.5 pthreads.
Wonder if this will break it on all other platforms :-)
1996-06-11 18:32:18 +00:00
Guido van Rossum 582646aecc grand renaming; added copyright to some files 1996-05-28 22:30:17 +00:00
Guido van Rossum 0a8626eb88 Plug memory leak (variable names in code objects were being leaked!) 1996-05-28 22:28:12 +00:00
Guido van Rossum 8c1e150215 Removed some done "to do" items.
Changed #ifdef DEBUG slightly.
1996-05-24 20:49:24 +00:00
Guido van Rossum ded690fc35 rename printrefs, getobjects to _Py_ prefix 1996-05-24 20:48:31 +00:00
Guido van Rossum dadc824c6e removed verbose decl; added win3.1 dynamic linking. 1996-05-23 22:51:40 +00:00
Guido van Rossum 40f470f7e0 moved verbose decl to pydebug.h; added dos_8x3 feature 1996-05-23 22:51:04 +00:00
Guido van Rossum f857a6becb Added copyright.
Include config.h which may define COMPILER.
1996-05-23 22:50:26 +00:00
Guido van Rossum 5e3e426961 removed sime redundant header includes and decls. 1996-05-23 22:49:38 +00:00
Guido van Rossum 795ba583f2 Removed some redundant header includes.
dir(object) now returns object.__dict__.keys() even if __dict__ is not
a dictionary.
1996-05-23 22:49:07 +00:00
Guido van Rossum 7f3f2c1819 TRACE_REFS -> Py_TRACE_REFS 1996-05-23 22:45:41 +00:00
Guido van Rossum aae0d32f66 Use new names for debug macros. Don't include pythonrun.h. 1996-05-22 16:35:33 +00:00
Guido van Rossum 9c9a07c9c9 Remember source filename as <module>.__file__. 1996-05-16 20:43:40 +00:00
Guido van Rossum d17057745c Add list() method, analogous to tuple(). 1996-04-09 02:41:06 +00:00
Guido van Rossum a5a3db70d4 Under NT, interface to mysterious module registry. (Mark H.) 1996-04-09 02:39:59 +00:00
Guido van Rossum e71a947f8e Under NT, change "long" sharedlib extension to ".dll". (Mark H.) 1996-04-09 02:39:15 +00:00
Guido van Rossum c606fe186f Under NT, define sys.dllhandle and sys.winver (Mark H.). 1996-04-09 02:37:57 +00:00
Guido van Rossum 4f1c59b818 Add'l change for NT (Mark H.). 1996-04-09 02:37:03 +00:00
Guido van Rossum 25e852985f __FreeBSD__ shared libraries 1996-02-25 05:02:29 +00:00
Guido van Rossum be1a6e29e3 Change Mac creator from 'PYTH' to 'Pyth' -- 'PYTH' was already taken
by someone else, 'Pyth' is now officially registered by the PSA.
1996-02-21 15:29:20 +00:00
Guido van Rossum 15ad9a6e52 only use 'j' for imaginary constants 1996-01-26 20:53:56 +00:00
Guido van Rossum c96ef6ab9e properly initialize optional arguments to apply() 1996-01-26 20:44:30 +00:00
Jack Jansen 1e7b2aa5d6 Removed unused var 1996-01-25 16:11:19 +00:00
Sjoerd Mullender 996e6dc959 Corrected format string in api_version_warning. 1996-01-23 16:07:29 +00:00
Guido van Rossum ff4af06735 __hpux -> hpux equivalence 1996-01-12 01:17:50 +00:00
Guido van Rossum b0352fa3fc fix args options for setcheckinterval 1996-01-12 01:15:01 +00:00
Guido van Rossum beeda8a7ba changes for power (**) operator 1996-01-12 01:13:38 +00:00
Guido van Rossum 50564e8dae changes for complex and power (**) operator 1996-01-12 01:13:16 +00:00
Guido van Rossum 8a5c5d277e changes for complex numbers 1996-01-12 01:09:56 +00:00
Guido van Rossum 72b56e831f don't return from main loop when error occurs 1995-12-10 04:57:42 +00:00
Jack Jansen 66a8977b0e Moved mac-specific exit handling to macmain.c 1995-10-27 13:22:14 +00:00
Jack Jansen 9513f2c95a Made a bit more robust against out-of-memory situations 1995-10-27 13:21:28 +00:00
Jack Jansen 0a72e8d4d2 Added missing include for <Aliases.h> 1995-10-23 13:54:01 +00:00
Guido van Rossum 6c066885f1 set date to oct 13 1995-10-12 00:48:18 +00:00
Guido van Rossum 53f4524a92 disable code generation for access statement 1995-10-08 00:42:46 +00:00
Guido van Rossum 1c45ca310b keep exitfunc alive while calling it 1995-10-07 19:14:01 +00:00
Jack Jansen 95ffa23597 Removed unused variables 1995-10-03 14:38:41 +00:00
Guido van Rossum a1e7e62893 fix bug with missing default for last arg (discovered by Tommy Burnette) 1995-09-18 21:44:04 +00:00
Guido van Rossum befa14f1b9 #undef argument, for the Mac 1995-09-18 21:42:42 +00:00
Guido van Rossum 020dfe7f2e include Python.h 1995-09-18 21:40:19 +00:00
Guido van Rossum 650ae0ab06 remove unwanted fatal() from err_badcall() 1995-09-18 21:31:16 +00:00
Guido van Rossum 9d78d8d2fb spell TraceBack with capital B 1995-09-18 21:29:36 +00:00
Sjoerd Mullender 6ec3c653da Implemented two new functions in sys:
getcounts() returns a list of counts of allocations and
		deallocations for all different object types.
	getobjects(n [, type ]) returns a list of recently allocated
		and not-yet-freed objects of the given type (all
		objects if no type given).  Only the n most recent
		(all if n==0) objects are returned.
getcounts is only available if compiled with -DCOUNT_ALLOCS,
getobjects is only available if compiled with -DTRACE_REFS.  Note that
everything must be compiled with these options!
1995-08-29 09:18:14 +00:00
Guido van Rossum 05870115fc rd_object() with exception is fatal error 1995-08-28 02:56:20 +00:00
Guido van Rossum 69f6ee6a9d err_badcall() is fatal error 1995-08-28 02:55:48 +00:00
Guido van Rossum 667d704997 Initial revision 1995-08-04 04:20:48 +00:00
Guido van Rossum e3e61c1642 empty kw dict is ok for builtins 1995-08-04 04:14:47 +00:00
Guido van Rossum a1633cd993 split cofnfig.c in 1000 little files :-) 1995-08-04 04:13:00 +00:00
Guido van Rossum 47ad5e7d81 moved stuff around to resemble main.c 1995-08-04 04:10:43 +00:00
Guido van Rossum 6ec1efb645 add imp.get_frozen_object() 1995-08-04 04:08:57 +00:00
Guido van Rossum b7b45627e8 avoid resize of 0-length tuple 1995-08-04 04:07:45 +00:00
Jack Jansen 21eb0b56a8 mac CW-only fix for messy windows upon exit 1995-07-29 13:55:06 +00:00
Jack Jansen b7d0df4a91 Allow mac user to set "command line flags" by option-starting python. 1995-07-29 13:53:59 +00:00
Guido van Rossum 0db1ef96ac fix bogus DECREF in finally clause 1995-07-28 23:06:00 +00:00
Jack Jansen 614cf81606 Undef 'argument' before including mac headers 1995-07-28 11:28:14 +00:00
Guido van Rossum ff8b494cf0 changes for keyword args to built-in functions and classes 1995-07-26 18:16:42 +00:00
Guido van Rossum ce0a6ded4d never close the file in imp.load_... 1995-07-26 18:13:27 +00:00
Guido van Rossum 53bb7fff11 be more suspicious of getlocals() 1995-07-26 16:26:31 +00:00
Guido van Rossum 681d79aaf3 keyword arguments and faster calls 1995-07-18 14:51:37 +00:00
Guido van Rossum 11a3f0c2bc NT specific change for nicer error message (Mark H) 1995-07-18 14:40:09 +00:00
Guido van Rossum 32120311ed rename arglist to alist (conflict with new grammar symbol) 1995-07-10 13:52:21 +00:00
Guido van Rossum f10570b9eb 3rd arg for raise; INCOMPLETE keyword parameter passing (currently f(kw=value) is seen as f('kw', value)) 1995-07-07 22:53:21 +00:00
Guido van Rossum 7faeab3103 new MAGIC; some changes to default files for imp.load_... functions 1995-07-07 22:50:36 +00:00
Guido van Rossum e78c5d0a16 ignore control-l (parallelling change to tokenizer.c) 1995-07-07 22:45:41 +00:00
Guido van Rossum aaf18390ee added sys.platform 1995-07-07 22:45:02 +00:00
Guido van Rossum e40bddc3ef new grammar 1995-07-07 22:44:10 +00:00
Guido van Rossum 872537cc86 added locals() and globals(); [raw_]input() uses readline() 1995-07-07 22:43:42 +00:00