Commit Graph

210 Commits

Author SHA1 Message Date
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 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 9e51f9bec8 bltinmodule.c: added round(x, [n]); coerce() of two class instances
will try to coerce anyway.
classobject.c: instance 'nonzero' should first try __nonzero__
only then __len__.
1993-02-12 16:29:05 +00:00
Guido van Rossum bf80e5407f * stdwinmodule.c: various new commands: setwin{pos,size},
listfontnames, bitmap ops.
* listobject.c: use mkvalue() when possible; avoid weird error when
  calling append() without args.
* modsupport.c: new feature in getargs(): if the format string
  contains a semicolor the string after that is used as the error
  message instead of "bad argument list (format %s)" when there's an
  error.
1993-02-08 15:49:17 +00:00
Guido van Rossum 6f5afc9a73 * ceval.c: ifdef out the last argument passing compat hack.
* Fixed memory leaks in socket, select and sv modules: mkvalue("O", v)
  does INCREF(v) so if v is brand new it should be XDECREF'd
1993-02-05 09:46:15 +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 0b0db8e3a0 Added separate main program for the Mac: macmain.c
stdwinmodule.c: wsetfont can now return an error
Makefile: add CL_USE and CL_LIB*S; config.c: move CL part around
New things in imgfile; also in Makefile.
longobject.c: fix comparison of negative long ints...  [REAL BUG!]
marshal.c: add dumps() and loads() to read/write strings
timemodule.c: make sure there's always a floatsleep()
posixmodule.c: rationalize struct returned by times()
Makefile: add test target, disable imgfile by default
thread.c: Improved coexistance with dl module (sjoerd)
stdwinmodule.c: Change include stdwin.h if macintosh
rotormodule.c: added missing last argument to RTR_?_region calls
confic.c: merged with configmac.c, added 1993 to copyright message
fileobject.c: int compared to NULL in writestring(); change fopenRF ifdef
timemodule.c: simplify times() using mkvalue; include myselect.h
  earlier (for sequent).
posixmodule: for sequent, include unistd.h instead of explicit
  extern definitions and don't define rename()
Makefile: change misleading/wrong MD5 comments
1993-01-21 16:07:51 +00:00
Sjoerd Mullender 76ab5feb45 ushdr_t was not defined so fill in its size instead of using sizeof. 1993-01-13 12:49:46 +00:00
Sjoerd Mullender e89341250d Added error checking.
Improved coexistance with dl module.
1993-01-13 12:08:48 +00:00
Guido van Rossum 775f4dacbc * Makefile: use cp -r to install the library
* ceval.c: use #ifdef COMPAT_HACKS instead of #if 0
* Makefile: fix to make clmodule.c compile;
  make config.o dependent on libpython.a (so date is always correct)
* timemodule.c: now sleep() also takes a float argument.
* posixmodule.c: added nice().
1993-01-09 17:18:52 +00:00
Sjoerd Mullender ed59d205a9 Various changes.
* Makefile: svmodule.c.proto and svgen.py are gone, svmodule.c came in
	their stead.  Also, pass -DUSE_DL flag to thread.c and give
	the user a possibility to add the -DDEBUG to just thread.c.
* ceval.c: init_save_thread() can be called more than once now.
* svgen.py, svmodule.c.proto, svmodule.c: Removed prototype file and
	replaced it by the generated file.
* thread.c: Added some more checks; added call to DL library when it
	is also used to tell it where the shared arena is so that DL
	can use some other area.
* threadmodule.c: Call init_save_thread from another place.  Also,
	added new function getlocklock() which does to lock objects
	what getfilefile does to file objects.
1993-01-06 13:36:38 +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 d014ea6b5e * classobject.c: in instance_lenth, test result of call_object
for exception before using it.  Fixed a few other places where the
  outcome of calling sq_length wasn't tested for exceptions
  (bltinmodule.c, ceval.c).
1992-11-26 10:30:26 +00:00
Guido van Rossum c89705d697 * config.c: Added audioop to lists.
* Makefile: change default source directory
* socketmodule.c: added getsockname and getpeername
* bltinmodule.c: corrected typo in type() error message
* Added new built-in functions str() and repr(): repr(x) == `x`;
  str(x) == x if x is a string, otherwise str(x) == repr(x).
* Added joinfields to stropmodule.c (string.join calls joinfields now)
1992-11-26 08:54:07 +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 2dff991f6b Give code objects a more useful representation. 1992-09-03 20:50:59 +00:00
Guido van Rossum 99bec95482 Add some debugging features if DEBUG defined
(fetch the filename as a string so I can see it with dbx, and set f_lineno);
call abort() when detecting an "undetected" error.
1992-09-03 20:29:45 +00:00
Guido van Rossum 59bff399a0 Add sys.exitfunc feature. Make askync non-static. 1992-09-03 20:28:00 +00:00
Guido van Rossum da8cd8638f Add $PYTHONSTARTUP feature. 1992-09-03 20:26:57 +00:00
Guido van Rossum 14b4adbd33 Add an optional interface to turn malloc debugging on and off. 1992-09-03 20:25:30 +00:00
Sjoerd Mullender 2179945eec newest version 1992-09-02 12:54:36 +00:00
Sjoerd Mullender aee8bc1fab adapted SV module to the new svideo library.
update thread package.
1992-09-02 11:25:37 +00:00
Guido van Rossum a93265a666 suppress unnecessary error message if too many arguments are passed 1992-08-27 07:45:12 +00:00
Guido van Rossum f9a2d33f01 fix *serious* (new) bug in testbool: by default objects should test
true, not false!!!
1992-08-19 16:41:45 +00:00
Guido van Rossum 2b81dc9c00 fix *serious* (new) bug in evalfile: forgot to initialize s!!! 1992-08-19 16:40:53 +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 94390a4eaf use getargs() in more cases;
oct(0) should return '0', not '00'
1992-08-14 15:14:30 +00:00
Guido van Rossum 96caaee836 check for embedded \0 in strings for z and s formats 1992-08-14 15:12:03 +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 df72a655b9 To ignore a call, cast it to (void), not to (void *)... 1992-08-12 15:27:32 +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 5dc8eb0914 sysmodule.c: calling sys.settrace() or sys.setprofile() without
arguments crashed in INCREF() calls which should be XINCREF() calls.

timemodule.c: fix for SEQUENT port (sys/select, struct timezone) by
Jaap Vermeulen

xxobject.c: include modsupport.h
1992-06-19 13:57:27 +00:00
Guido van Rossum 138e6bf66e Removed confusing, incorrect comment. 1992-06-03 17:08:15 +00:00
Guido van Rossum ab2490a6d5 Added new types to setattr() as well... 1992-06-03 17:07:23 +00:00
Guido van Rossum 899dcf36a0 Added parameter decls to do_mkvalue for non-template machines 1992-05-15 11:04:59 +00:00
Guido van Rossum fc61adb5f1 Merged with Steve Miale's version 1992-04-13 15:53:41 +00:00
Guido van Rossum 3cfe6faffe Added mkvalue() function 1992-04-13 10:48:55 +00:00
Guido van Rossum bd9ccca812 Test for NULL coming out of err_get() in call_exc_trace() 1992-04-09 14:58:08 +00:00
Guido van Rossum 801dcae64d reverse sense of test for CHECKEXC 1992-04-08 11:32:32 +00:00
Guido van Rossum 5b7313a982 Arg of cmp_outcome becomes an int for portability to the Mac 1992-04-06 13:24:57 +00:00
Guido van Rossum 7cdf5eb5b9 Don't use NULL as 0 int! 1992-04-06 12:34:45 +00:00
Guido van Rossum 74b31c9826 Latest gramamr 1992-04-06 12:34:37 +00:00