Commit Graph

200 Commits

Author SHA1 Message Date
Guido van Rossum 81daa32c15 Access checks now work, at least for instance data (not for methods
yet).  The class is now passed to eval_code and stored in the current
frame.  It is also stored in instance method objects.  An "unbound"
instance method is now returned when a function is retrieved through
"classname.funcname", which when called passes the class to eval_code.
1993-05-20 14:24:46 +00:00
Guido van Rossum 25831652fd Several changes in one:
(1) dictionaries/mappings now have attributes values() and items() as
well as keys(); at the C level, use the new function mappinggetnext()
to iterate over a dictionary.

(2) "class C(): ..." is now illegal; you must write "class C: ...".

(3) Class objects now know their own name (finally!); and minor
improvements to the way how classes, functions and methods are
represented as strings.

(4) Added an "access" statement and semantics.  (This is still
experimental -- as long as you don't use the keyword 'access' nothing
should be changed.)
1993-05-19 14:50:45 +00:00
Guido van Rossum f56e3db1dd Support for frozen scripts; added -i option. 1993-04-01 20:59:32 +00:00
Guido van Rossum 5b7221849e * Fixed some subtleties with fastlocals. You can no longer access
f_fastlocals in a traceback object (this is a core dump hazard
  if there are <nil> entries), but instead eval_code() merges the fast
  locals back into the locals dictionary if it looks like the local
  variables will be retained.  Also, the merge routines save
  exceptions since this is sometimes needed (alas!).

* Added id() to bltinmodule.c, which returns an object's address
  (identity).  Useful to walk arbitrary data structures containing
  cycles.

* Added compile() to bltinmodule.c and compile_string() to
  pythonrun.[ch]: support to exec/eval arbitrary code objects.  The
  code that defaults globals and locals is moved from run_node in
  pythonrun.c (which is now identical to eval_node) to eval_code in
  ceval.c.  [XXX For elegance a clean-up session is necessary.]
1993-03-30 17:46:03 +00:00
Guido van Rossum 8b17d6bd89 Changes to speed up local variables enormously, by avoiding dictionary
lookup (opcode.h, ceval.[ch], compile.c, frameobject.[ch],
pythonrun.c, import.c).  The .pyc MAGIC number is changed again.
Added get_menu_text to flmodule.
1993-03-30 13:18:41 +00:00
Guido van Rossum 9bfef44d97 * Changed all copyright messages to include 1993.
* Stubs for faster implementation of local variables (not yet finished)
* Added function name to code object.  Print it for code and function
  objects.  THIS MAKES THE .PYC FILE FORMAT INCOMPATIBLE (the version
  number has changed accordingly)
* Print address of self for built-in methods
* New internal functions getattro and setattro (getattr/setattr with
  string object arg)
* Replaced "dictobject" with more powerful "mappingobject"
* New per-type functio tp_hash to implement arbitrary object hashing,
  and hashobject() to interface to it
* Added built-in functions hash(v) and hasattr(v, 'name')
* classobject: made some functions static that accidentally weren't;
  added __hash__ special instance method to implement hash()
* Added proper comparison for built-in methods and functions
1993-03-29 10:43:31 +00:00
Guido van Rossum 4b1302bd1d Generalized version of dictionaries, with compatibility hacks. 1993-03-27 18:11:32 +00:00
Guido van Rossum e537240c25 * Changed many files to use mkvalue() instead of newtupleobject().
* Fixcprt.py: added [-y file] option, do only files younger than file.
* modsupport.[ch]: added vmkvalue().
* intobject.c: use mkvalue().
* stringobject.c: added "formatstring"; renamed string* to string_*;
  ceval.c: call formatstring for string % value.
* longobject.c: close memory leak in divmod.
* parsetok.c: set result node to NULL when returning an error.
1993-03-16 12:15:04 +00:00
Guido van Rossum 34679b7661 * Added Fixcprt.py: script to fix copyright message.
* various modules: added 1993 to copyright.
* thread.c: added copyright notice.
* ceval.c: minor change to error message for "+"
* stdwinmodule.c: check for error from wfetchcolor
* config.c: MS-DOS fixes (define PYTHONPATH, use DELIM, use osdefs.h)
* Add declaration of inittab to import.h
* sysmodule.c: added sys.builtin_module_names
* xxmodule.c, xxobject.c: fix minor errors
1993-01-26 13:33:44 +00:00
Guido van Rossum a2b7f40513 * Configure.py: use #!/usr/local/bin/python
* posixmodule.c: move extern function declarations to top
* listobject.c: cmp() arguments must be void* if __STDC__
* Makefile, allobjects.h, panelmodule.c, modsupport.c: get rid of
  strdup() -- it is a portability risk
* Makefile: enclosed ranlib command in parentheses for Sequent Make
  which aborts if the command is not found even if '-' is present
* timemodule.c: time() returns a floating point number, in microsecond
  precision if BSD_TIME is defined.
1993-01-04 09:09:59 +00:00
Guido van Rossum 5f59d6018e * mymalloc.h: always allocate one extra byte, since some malloc's
return NULL for malloc(0) or realloc(p, 0).  (This should be done
  differently than wasting one byte, but alas...)
* Moved "add'l libraries" option in Makefile to an earlier place.
* Remove argument compatibility hacks (b) and (c).
* Add grey2mono, dither2mono and mono2grey to imageop.
* Dup the fd in socket.fromfd().
* Added new modules mpz, md5 (by JH, requiring GNU MP 1.2).  Affects
  Makefile and config.c.
* socketmodule.c: added socket.fromfd(fd, family, type, [proto]),
  converted socket() to use of getargs().
1992-12-14 16:59:51 +00:00
Guido van Rossum a9e7dc1081 * bltinmodule.c: added built-in function cmp(a, b)
* flmodule.c: added {do,check}_only_forms to fl's list of functions;
  and don't print a message when an unknown object is returned.

* pythonrun.c: catch SIGHUP and SIGTERM to do essential cleanup.

* Made jpegmodule.c smaller by using getargs() and mkvalue() consistently.

* Increased parser stack size to 500 in parser.h.

* Implemented custom allocation of stack frames to frameobject.c and
  added dynamic stack overflow checks (value stack only) to ceval.c.
  (There seems to be a bug left: sometimes stack traces don't make sense.)
1992-10-18 18:53:57 +00:00
Guido van Rossum 3165fe6a56 Modified most (but not yet all) I/O to always go through sys.stdout or
sys.stderr or sys.stdin, and to work with any object as long as it has
a write() (respectively readline()) methods.  Some functions that took
a FILE* argument now take an object* argument.
1992-09-25 21:59:05 +00:00
Guido van Rossum 1899c2e055 Made builtins int(), long(), float(), oct() and hex() more generic. 1992-09-12 11:09:23 +00:00
Sjoerd Mullender d10d8291f1 Added C++ support in thread.h; don't use signals if not strictly
necessary, and when they are, use SIGKILL; when compiled with -DDEBUG,
only print debug messages when "THREADDEBUG" is set in the environment.
1992-09-11 15:19:27 +00:00
Guido van Rossum 3702284d2a Correct spelling in function name 1992-09-03 20:46:06 +00:00
Guido van Rossum f2c8beba0b AOnly define NDEDBUG if DEBUG is not defined 1992-09-03 20:34:07 +00:00
Guido van Rossum 1e28e5e596 * renamed malloc.h mymalloc.h, and added MALLARG as the type of the
argument to malloc() (size_t or unsigned int)

* listobject.c: check for overflow of the size of the object,
  so things like range(0x7fffffff) will raise MemoryError instead
  of calling malloc() with -4 (and then crashing -- malloc's fault)
1992-08-19 16:46:30 +00:00
Guido van Rossum f9f2e82fca New thread.c from Sjoerd, supports _exit_prog(). Use this in goaway()
to avoid hanging in cleanup().
1992-08-17 08:59:08 +00:00
Guido van Rossum e6eefc2231 * classobject.[ch], {float,long,int}object.c, bltinmodule.c:
coercion is now completely generic.
* ceval.c: for instances, don't coerce for + and *; * reverses
  arguments if left one is non-instance numeric and right one sequence.
1992-08-14 12:06:52 +00:00
Guido van Rossum 04691fc1c1 Changes so that user-defined classes can implement operations invoked
by special syntax: you can now define your own numbers, sequences and
mappings.
1992-08-12 15:35:34 +00:00
Guido van Rossum ff4949eeee * Makefile: cosmetics
* socketmodule.c: get rid of makepair(); fix makesocketaddr to fix
  broken recvfrom()
* socketmodule: get rid of getStrarg()
* ceval.h: move eval_code() to new file eval.h, so compile.h is no
  longer needed.
* ceval.c: move thread comments to ceval.h; always make save/restore
  thread functions available (for dynloaded modules)
* cdmodule.c, listobject.c: don't include compile.h
* flmodule.c: include ceval.h
* import.c: include eval.h instead of ceval.h
* cgen.py: add forground(); noport(); winopen(""); to initgl().
* bltinmodule.c, socketmodule.c, fileobject.c, posixmodule.c,
  selectmodule.c:
  adapt to threads (add BGN/END SAVE macros)
* stdwinmodule.c: adapt to threads and use a special stdwin lock.
* pythonmain.c: don't include getpythonpath().
* pythonrun.c: use BGN/END SAVE instead of direct calls; also more
  BGN/END SAVE calls etc.
* thread.c: bigger stack size for sun; change exit() to _exit()
* threadmodule.c: use BGN/END SAVE macros where possible
* timemodule.c: adapt better to threads; use BGN/END SAVE; add
  longsleep internal function if BSD_TIME; cosmetics
1992-08-05 19:58:53 +00:00
Guido van Rossum 1984f1e1c6 * Makefile adapted to changes below.
* split pythonmain.c in two: most stuff goes to pythonrun.c, in the library.
* new optional built-in threadmodule.c, build upon Sjoerd's thread.{c,h}.
* new module from Sjoerd: mmmodule.c (dynamically loaded).
* new module from Sjoerd: sv (svgen.py, svmodule.c.proto).
* new files thread.{c,h} (from Sjoerd).
* new xxmodule.c (example only).
* myselect.h: bzero -> memset
* select.c: bzero -> memset; removed global variable
1992-08-04 12:41:02 +00:00
Guido van Rossum 4fbf798f86 * myselect.h: bzero -> memset
* select.c: bzero -> memset; removed global variable
1992-08-04 09:13:45 +00:00
Guido van Rossum ed233a5696 Changes for new UNIX-specific built-in module 'select' and new header for
interfaces to variants of select() system call, "myselect.h".  This includes
adding fileno() methods to files, sockets and stdwin.
1992-06-23 09:07:03 +00:00
Guido van Rossum 000239517d added BYTE, CHAR and unsigned variants 1992-06-03 17:07:40 +00:00
Guido van Rossum 5a8f824933 Added declaration for mkvalue() 1992-04-13 15:54:59 +00:00
Guido van Rossum 5113f5fd34 Copyright for 1992 added 1992-04-05 14:20:22 +00:00
Guido van Rossum 704a26c5f3 lint (added flushline() interface) 1992-03-27 17:29:31 +00:00
Guido van Rossum 559e55f73c Make it lint-free 1992-03-27 17:23:59 +00:00
Guido van Rossum c1b5cec10e *** empty log message *** 1992-03-24 13:46:39 +00:00
Guido van Rossum 9b9ccd3fe3 Moved definition of search path DELIM here (from sysmodule.c). 1992-03-23 18:20:32 +00:00
Guido van Rossum d510c786b8 Added definitions of sys_trace and sys_profile 1992-03-23 18:20:04 +00:00
Guido van Rossum 355a33dc6e Initial revision 1992-02-26 15:19:31 +00:00
Guido van Rossum 550fbcc2aa New getargs() function. Define macros with conventional names,
except get*str*arg --> get*Str*arg; get*str*arg fetches a C string.
1992-01-27 16:50:21 +00:00
Guido van Rossum b674c3bba5 Initial revision 1992-01-19 16:32:47 +00:00
Guido van Rossum 44c8f69ff2 Added typedef for longobject and declarations for long_{format,scan}. 1992-01-19 16:31:28 +00:00
Guido van Rossum 3d09543472 Move the longobject typedef to longobject.h.
Remove some functions that need not be exported.
1992-01-19 16:30:12 +00:00
Guido van Rossum 7c36ad7f44 New function gettupleslice(v, i, j). 1992-01-14 18:45:33 +00:00
Guido van Rossum 11c03836a2 Change tb_here() prototype. 1992-01-14 18:45:09 +00:00
Guido van Rossum 22f863feee Added UNPACK_VARARG. 1992-01-14 18:38:56 +00:00
Guido van Rossum 088bc2ad3c Added f_lasti and f_lineno members. 1992-01-14 18:32:11 +00:00
Guido van Rossum 768a3f0ab8 Added SystemExit. 1991-12-31 13:13:47 +00:00
Guido van Rossum 85fc392b9e Added ImportError. 1991-12-24 13:26:33 +00:00
Guido van Rossum fb905c3ebf Regularize exceptions. 1991-12-16 15:42:38 +00:00
Guido van Rossum 750bf14c32 Added UNPACK_ARG. 1991-12-16 13:07:35 +00:00
Guido van Rossum c06022966f Add "varargs" attribute. 1991-12-16 13:07:24 +00:00
Guido van Rossum a317365eb2 SyntaxError. 1991-12-16 13:06:04 +00:00
Guido van Rossum 97ff5308fe Added _GLOBAL opcodes. 1991-12-10 13:59:17 +00:00
Guido van Rossum 876336bc7d New exceptions. 1991-12-10 13:56:23 +00:00
Guido van Rossum 7928cd7636 Added shift and mask ops. 1991-10-24 14:59:31 +00:00
Guido van Rossum 7a6dfa7d79 Added shifting and masking ops to as_number struct 1991-10-24 14:58:18 +00:00
Guido van Rossum 8883aaa5eb Added some new tokens 1991-10-20 20:24:45 +00:00
Guido van Rossum 2b9d6e2008 newclassobject gets a third parameter (optional class name) 1991-10-20 20:12:10 +00:00
Guido van Rossum 4b3c1da660 Added/moved dict2 interfaces. 1991-08-16 09:00:42 +00:00
Guido van Rossum 4f4a55b90c Change getbuiltin interface to get the name as an object. 1991-08-16 08:55:53 +00:00
Guido van Rossum 18315a0ecd New syntax 1991-07-27 21:38:01 +00:00
Guido van Rossum a049031f2d Added call_object interface 1991-07-27 21:33:03 +00:00
Guido van Rossum d6a15ada72 Generalize to macintosh. 1991-06-24 22:30:42 +00:00
Guido van Rossum 1e2293d1f7 Define 'macintosh' if THINK_C is defined. 1991-06-24 22:30:14 +00:00
Guido van Rossum 76085b95b9 Remove StopPrint hack 1991-06-07 22:50:34 +00:00
Guido van Rossum d783a46d73 printobject now returns an error code 1991-06-07 22:35:42 +00:00
Guido van Rossum 65481401b1 Add "close" function parameter to newopenfileobject(). 1991-06-07 13:57:38 +00:00
Guido van Rossum e24122f5e2 Export getdict2key() interface. 1991-06-07 13:57:16 +00:00
Guido van Rossum 4ed1ad5355 Export newcodeobject() interface. 1991-06-04 19:43:13 +00:00
Guido van Rossum dce2e3d8f5 Initial revision 1991-06-04 19:42:30 +00:00
Guido van Rossum 301f1a6f79 Added declarations for dnewlongobject and dgetlongvalue. 1991-06-03 10:58:51 +00:00
Guido van Rossum cf7423ac8f Added nonzero to number methods 1991-05-14 12:08:10 +00:00
Guido van Rossum badb116f5e Added wdigit and stwodigits typedefs, and changed prototypes. 1991-05-14 12:06:16 +00:00
Guido van Rossum 97ad2d80e5 Added divmod and abs methods for numbers 1991-05-05 20:11:43 +00:00
Guido van Rossum edcc38aac5 Initial revision 1991-05-05 20:09:44 +00:00
Guido van Rossum faf9c960a2 Renamed class members to instances and class methods to instance methods
,.
1991-05-05 20:04:55 +00:00
Guido van Rossum 9227c0e184 Added longobject.h 1991-05-05 20:00:02 +00:00
Guido van Rossum 0bd2441e00 Added external interface to readline, for raw_input(). 1991-04-04 15:21:57 +00:00
Guido van Rossum 054ff1f29e Added opcodes to load local/global variables 1991-04-04 10:45:01 +00:00
Guido van Rossum 572fd57b5a Changed 'class member' to 'instance'. 1991-04-04 10:42:27 +00:00
Guido van Rossum d594c91293 Added Getnamev() macro. 1991-04-03 19:03:22 +00:00
Guido van Rossum 88671aeabb Added declaration for dict2insert. 1991-04-03 19:02:06 +00:00
Guido van Rossum e543a94746 Satisfy Standard C rules about struct scope. 1991-04-03 19:00:55 +00:00
Guido van Rossum f70e43a073 Added copyright notice. 1991-02-19 12:39:46 +00:00
Guido van Rossum b156d7259b Changes for THINK C 4.0. 1990-12-20 23:13:00 +00:00
Guido van Rossum d05c4b2a7c Include <string.h> instead of "string.h". 1990-12-20 23:02:42 +00:00
Guido van Rossum 3f5da24ea3 "Compiling" version 1990-12-20 15:06:42 +00:00
Guido van Rossum 226d79eb4a Changed interface (no nodes but code). 1990-11-18 17:44:34 +00:00
Guido van Rossum f1270274e2 Added opcodes for classes. 1990-11-18 17:38:15 +00:00
Guido van Rossum cc398d1cbb Added prototype for new function freenode(). 1990-11-18 17:37:25 +00:00
Guido van Rossum 10dc2e8097 Initial revision 1990-11-18 17:27:39 +00:00
Guido van Rossum d5b70f5bac Add UNREF macro if not tracing refs (see UNREF function in object.c). 1990-11-18 17:27:10 +00:00
Guido van Rossum c8564cde04 Be more careful with negative reference counts. 1990-11-02 17:51:56 +00:00
Guido van Rossum 14da580104 Added prototype for sortlist(). 1990-10-30 13:32:39 +00:00
Guido van Rossum 6990c943a0 Added getdictkeys() prototype. 1990-10-30 13:27:43 +00:00
Guido van Rossum 3ccb6172f8 removed dir statement. Function arguments may now be tests. 1990-10-26 15:01:05 +00:00
Guido van Rossum 0558a205a3 Added getmodulename() public interface. 1990-10-26 15:00:11 +00:00
Guido van Rossum ed97f6aa04 Added prototype for reload_module. 1990-10-26 14:59:11 +00:00
Guido van Rossum 4ab9b4c9ad Changed strdup prototype to use const. 1990-10-21 22:13:08 +00:00
Guido van Rossum 3e55cb6302 Added err_badcall() and planned new errors. 1990-10-21 22:09:30 +00:00
Guido van Rossum 0539ba2c74 Removed declarations of err_badargs [sic] and err_nomem. 1990-10-14 20:03:07 +00:00
Guido van Rossum 5c600e1614 Made exception objects extern.
Added convenience functions.
1990-10-14 20:00:25 +00:00
Guido van Rossum ce4704a4f5 Remove dict2 interface -- it's now static. 1990-10-14 19:59:45 +00:00
Guido van Rossum 85a5fbbdfe Initial revision 1990-10-14 12:07:46 +00:00