Commit Graph

3724 Commits

Author SHA1 Message Date
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 7066dd75c5 * Makefile: added IMGFILE; moved some stuff around.
* flmodule.c: added some missing functions; changed readonly flags of
  some data members based upon FORMS documentation.
* listobject.c: fixed int/long arg lint bug (bites PC compilers).
* several: removed redundant print methods (repr is good enough).
* posixmodule.c: added (still experimental) process group functions.
1992-09-17 17:54:56 +00:00
Guido van Rossum 1899c2e055 Made builtins int(), long(), float(), oct() and hex() more generic. 1992-09-12 11:09:23 +00:00
Guido van Rossum 94472a0374 classobject.c moduleobject.c stdwinmodule.c xxobject.c:
raise AttributeError, not KeyError, when attribute deletion fails.
sunaudiodevmodule.c: check for deletion before calling setmember.
1992-09-04 09:45:18 +00:00
Guido van Rossum ba3690cd09 Remove outdated warning in comments. 1992-09-03 20:44:36 +00:00
Guido van Rossum 67daef567f Remove bogus type-and-refcnt setting from newsizedstringobject(). 1992-09-03 20:44:02 +00:00
Guido van Rossum ebc8c51cde Compare instance methods by comparing the object and the function. 1992-09-03 20:39:51 +00:00
Guido van Rossum 2e8f6140ff If a type has a repr function but no print function, printing it now
calls the repr function.  When the refcount is bad, don't print
the object at all (chances of crashes).
Changes to checking and printing of references: the consistency
check is somewhat faster; don't print strings referenced once
(most occur in function's name lists).
1992-09-03 20:32:55 +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 2c475427c2 oct(0) should return '0', not '00' 1992-08-14 15:13:07 +00:00
Guido van Rossum 6d946f98bd * macmodule.c: include allobjects.h, not .c
* timemodule.c: the mac has no unistd.h
* classobject.c: fixed several cases of return NULL that should be
  return -1 !!!
1992-08-14 13:49:30 +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 70d7a310a9 * xxobject.c: added tp_as_number, tp_as_sequence, tp_as_mapping to
the type object.
1992-08-14 12:04:19 +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 e10a19ea6d listobject.c: added optional cmp function to list.sort(). 1992-08-03 19:05:37 +00:00
Guido van Rossum c10aa77cb9 fileobject.c: fix fatal bug in getline() (forgot to initialize fp now) 1992-07-31 12:42:38 +00:00
Guido van Rossum d7297e61df Makefile: added instann rules and $(*DEST*) defines.
fileobject.c: report more moeaningful error for I/O on closed files;
user getargs() everywhere.
1992-07-06 14:19:26 +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 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 57639655c7 New copyright 1992-04-06 12:35:43 +00:00
Guido van Rossum bab9d03855 Copyright for 1992 added 1992-04-05 14:26:55 +00:00
Guido van Rossum 8dd79cf788 Don't allow assignment to attributes named __*__ 1992-04-05 14:24:32 +00:00
Guido van Rossum 719f5fa86a lint fix 1992-03-27 17:31:02 +00:00
Guido van Rossum 3132a5a7dc answer lint's complaints 1992-03-27 17:28:44 +00:00
Guido van Rossum 8b27d929a6 Lint stuff (involves casts, yuck!) 1992-03-27 17:27:05 +00:00
Guido van Rossum eec181ae88 Lint
./
1992-03-27 17:26:44 +00:00
Guido van Rossum 2a591667bd Lint 1992-03-27 17:26:38 +00:00
Guido van Rossum 0c182a1322 Fix lint bug 1992-03-27 17:26:13 +00:00
Guido van Rossum 96163c1dec Lint... 1992-03-27 17:24:47 +00:00
Guido van Rossum 85998fa069 Silence lint 1992-03-27 17:23:48 +00:00
Guido van Rossum 51415a7b3b Quiet lint 1992-03-27 17:23:38 +00:00
Guido van Rossum febd551bab Change error handling. Call clearerr() more often. 1992-03-04 16:39:24 +00:00
Guido van Rossum fa3da8aa7c Include modsupport.h for getargs(). 1992-01-27 16:53:23 +00:00
Guido van Rossum 56cd67ad47 Get rid of redundant type checks.
Define % operator similar to int%int.
1992-01-26 18:16:35 +00:00
Guido van Rossum e32e014c7e Add prototypes.
Change / and % to match divmod.
1992-01-19 16:31:05 +00:00
Guido van Rossum 2b16a6feff Make / and % do the same as divmod. 1992-01-19 16:28:51 +00:00
Guido van Rossum 7c36ad7f44 New function gettupleslice(v, i, j). 1992-01-14 18:45:33 +00:00
Guido van Rossum 4c260ff2a5 Changed to 2's complement bitwise ops. Got rid of ZABS etc. 1992-01-14 18:36:43 +00:00
Guido van Rossum f3b351f140 Different shift implementation. 1992-01-14 18:33:22 +00:00
Guido van Rossum a38c0ff7cd Added READONLY specifier to data members. 1992-01-14 18:32:20 +00:00
Guido van Rossum 088bc2ad3c Added f_lasti and f_lineno members. 1992-01-14 18:32:11 +00:00
Guido van Rossum afbb8db8e6 Fixed bug in long masking ops. 1991-12-31 13:14:13 +00:00
Guido van Rossum 3ea7412d38 Change error messages for impossible assignment slightly. 1991-12-24 13:28:03 +00:00
Guido van Rossum 32dffaa016 Fix assignment of a list to a slice of itself. 1991-12-24 13:27:34 +00:00
Guido van Rossum 201be057fb Added message to EOFError. 1991-12-24 13:26:41 +00:00
Guido van Rossum 7fa52f84c7 Explicitly check for weird values after calling pow(). 1991-12-16 15:43:14 +00:00
Guido van Rossum c06022966f Add "varargs" attribute. 1991-12-16 13:07:24 +00:00
Guido van Rossum 87e7ea72a6 Use new exceptions. 1991-12-10 14:00:03 +00:00
Guido van Rossum 2912f22afc Use IOError. 1991-12-10 13:59:09 +00:00
Guido van Rossum bd3a2e6b11 Use AttributeError. 1991-12-10 13:58:49 +00:00
Guido van Rossum 3a62845094 Improved exceptions. 1991-12-10 13:57:36 +00:00
Guido van Rossum 9a9faddbcb Formulate better error strings. 1991-12-10 13:56:55 +00:00
Guido van Rossum e2966a6362 The cl_bases member of a class object is now never NULL. 1991-12-10 13:53:23 +00:00
Guido van Rossum c6913e7da2 Made the sign use one's complement; implemented shifting and masking operators. 1991-11-19 20:26:46 +00:00
Guido van Rossum 670ceb30d3 Deleted unused local variable. 1991-11-19 20:26:11 +00:00
Guido van Rossum 8aff84a100 Call write(fileno(fp), ...) instead of fwrite for LARGE writes. 1991-11-12 15:42:49 +00:00
Guido van Rossum 7928cd7636 Added shift and mask ops. 1991-10-24 14:59:31 +00:00
Guido van Rossum 3d3037d51a Changed convert to add '0' or '0x' prefix for oct/hex.
Added NULL function pointers for shift and mask ops.
1991-10-24 14:55:57 +00:00
Guido van Rossum 27acb3379e Added NULL function pointers for shift and mask ops. 1991-10-24 14:55:28 +00:00
Guido van Rossum e9c430fd3b Implemented __methods__ attribute 1991-10-20 20:21:15 +00:00
Guido van Rossum e6f7d18e6b Added count() method.
Changed some conditional INCREFs into XINCREFs.
1991-10-20 20:20:40 +00:00
Guido van Rossum 15ecff4c5e Finally implemented divmod(). 1991-10-20 20:16:45 +00:00
Guido van Rossum 9430839acc Add several secret __*__ attributes 1991-10-20 20:11:48 +00:00
Guido van Rossum 18a372f04c getlonglongargs --> getlonglongarg 1991-09-10 14:55:58 +00:00
Guido van Rossum 278ef59110 Check for write errors after printing a value 1991-07-27 21:40:24 +00:00
Guido van Rossum 2fe53f7fec The print operation now returns status! 1991-07-01 18:52:31 +00:00
Guido van Rossum 9fb036811a Change cmpobject() to coerce numerical values before comparing them 1991-07-01 18:48:04 +00:00
Guido van Rossum 49e85146e2 printobject now returns an error code
Remove superfluous err_nomem() call
,
1991-06-07 22:59:30 +00:00
Guido van Rossum bcaa31c411 printobject now returns an error code
Remove superfluous err_nomem() call
1991-06-07 22:58:57 +00:00
Guido van Rossum 909336104b printobject now returns an error code 1991-06-07 16:10:43 +00:00
Guido van Rossum 27dec7e376 Export float_buf_repr() interface, for marshalling of floats. 1991-06-04 19:42:53 +00:00
Guido van Rossum a1ab7fae44 In support of popen(), file objects are now parametrized with a close
function on creation.  (There's a funny thing about the return
value of the close function that should be resolved.)
Also added 'isatty' method.
1991-06-04 19:37:39 +00:00
Guido van Rossum f380e66c0f Fix comments in string_as_sequence 1991-06-04 19:36:32 +00:00
Guido van Rossum b8393da8f8 Finally implement tuple*number. From now on all sequence types
must (pretend to) support all operations except assignments;
if you don't want to support an operation you have to provide
a dummy function that raises an exception...
1991-06-04 19:35:24 +00:00
Guido van Rossum 149e9ea24c Added dnewlongobject(), function to convert double to long int. 1991-06-03 10:58:24 +00:00
Guido van Rossum 76ad8ed51d Call clearerr() after EOF seen. 1991-06-03 10:54:55 +00:00
Guido van Rossum c7ec9c98e2 Fix off-by-one error in long_repr.
Implement long_pow.
1991-05-28 21:58:16 +00:00
Guido van Rossum 70d934601f Fix special cases in pow() 1991-05-28 21:57:39 +00:00
Guido van Rossum 23d6f0e8e7 Many small changes 1991-05-14 12:06:49 +00:00
Guido van Rossum 0bff015ac3 Added nonzero test 1991-05-14 12:05:32 +00:00
Guido van Rossum 50b4ef64eb Added nonzero test 1991-05-14 11:57:01 +00:00
Guido van Rossum 05ab111b1d Enabled (and fixed) newvarobject() 1991-05-05 20:10:41 +00:00
Guido van Rossum edcc38aac5 Initial revision 1991-05-05 20:09:44 +00:00
Guido van Rossum 0046695d0c Added divmod and abs, fixed negative powers 1991-05-05 20:08:27 +00:00
Guido van Rossum eba1b5efe1 Added (dummy) divmod and (functional) abs.
Fixed comments in number methods list
1991-05-05 20:07:00 +00:00
Guido van Rossum e8122f19a0 Renamed class methods to instance methods (which they are) 1991-05-05 20:03:07 +00:00
Guido van Rossum bfe14c5c92 Add warning about Lambert's bug. 1991-04-16 08:41:06 +00:00
Guido van Rossum 569fce7901 Rename class methods to instance methods (at least where user-visible) 1991-04-16 08:38:43 +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 daa8bb334d Optimized single-character strings gotten from s[i]. 1991-04-04 10:48:33 +00:00
Guido van Rossum eb183da74f Added 'softspace' interface to replace 'needspace' printing hack. 1991-04-04 10:44:06 +00:00
Guido van Rossum 21ed88cfe2 Change ugly 'class member' to more normal 'instance'. 1991-04-04 10:42:10 +00:00
Guido van Rossum 4a450d06c7 Swapped list_ass_item and list_ass_slice to satisfy Standard C. 1991-04-03 19:05:18 +00:00
Guido van Rossum b6a6bdc7db Optimized stringitem. 1991-03-06 13:15:02 +00:00
Guido van Rossum ed98d48027 Added repeat (for list*integet).
Added methods remove(), reverse() and index().
1991-03-06 13:07:53 +00:00
Guido van Rossum ce5ba841d9 Fixed read() and readline() to do arbitrarily long reads.
And readline() now reads null bytes correctly.
Added tell(), seek() and flush().
1991-03-06 13:06:18 +00:00
Guido van Rossum f70e43a073 Added copyright notice. 1991-02-19 12:39:46 +00:00
Guido van Rossum a08095ab02 Hack to open resource fork on the Mac: open(filename, '*rb'). 1991-02-13 23:25:27 +00:00
Guido van Rossum 253919f3b7 Fix stringcompare when strings contain null bytes. 1991-02-13 23:18:39 +00:00
Guido van Rossum 94726d55c1 Changed bogus ref to textobject into xxobject. 1991-01-02 15:12:51 +00:00
Guido van Rossum 320a5ccbdc Fixed a bit (still no warranties). 1991-01-02 15:11:48 +00:00
Guido van Rossum 59b3590711 Think C 4.0 fixes a bug in 3.0 that we programmed around. 1991-01-02 13:51:41 +00:00
Guido van Rossum 73531a3bae Return -1 for errors. 1990-12-20 23:12:40 +00:00
Guido van Rossum c211ee4b13 Added <errno.h> 1990-12-20 23:06:26 +00:00
Guido van Rossum 3f5da24ea3 "Compiling" version 1990-12-20 15:06:42 +00:00
Guido van Rossum 846e431372 Function objects no longer contain a parse tree node, but intermediate
code.
1990-11-18 17:44:06 +00:00
Guido van Rossum 392ab32859 Fix wrong #ifdef. 1990-11-18 17:41:19 +00:00
Guido van Rossum 921842f2c2 Fixed resizestring() to work if reference tracing is turned on.
The realloc() call would move the list head without fixing the
pointers to in the the chain of allocated objects...
1990-11-18 17:30:23 +00:00
Guido van Rossum 6923e134fc Moved prototyes for fmod and pow, and don't use them for THINK C. 1990-11-02 17:50:43 +00:00
Guido van Rossum bd3edc8dc3 Removed redundant prototype for err_nomem().
Added check for negative refcnt in DELREF.
1990-11-02 17:49:51 +00:00
Guido van Rossum 84c76f52af Added external interface to sort a list. 1990-10-30 13:32:20 +00:00
Guido van Rossum 726749cc5b Added some prototypes. 1990-10-30 13:30:32 +00:00
Guido van Rossum 0558a205a3 Added getmodulename() public interface. 1990-10-26 15:00:11 +00:00
Guido van Rossum abbda16f58 Fix zero division checks: return if it occurs! 1990-10-26 14:58:41 +00:00
Guido van Rossum dd5c7be568 Reads of zero should be legal! 1990-10-26 14:58:11 +00:00
Guido van Rossum 2a9096b5f9 New errors. 1990-10-21 22:15:08 +00:00
Guido van Rossum e87203afde Added __dict to module getattr.
New errors.
1990-10-21 22:12:30 +00:00
Guido van Rossum 5c52b6a75a CHanged errors somewhat. 1990-10-21 22:11:03 +00:00
Guido van Rossum 2b654f74c2 New error handling in getattr(). 1990-10-14 20:03:32 +00:00
Guido van Rossum 165e67edae New error handling. 1990-10-14 20:02:26 +00:00
Guido van Rossum 3cf0ddfd94 (Some) new error handling. 1990-10-14 19:58:09 +00:00
Guido van Rossum 85a5fbbdfe Initial revision 1990-10-14 12:07:46 +00:00