Commit Graph

54 Commits

Author SHA1 Message Date
Guido van Rossum 27a60b147c PyFile_WriteString now returns an error indicator instead of calling
PyErr_Clear().
1997-05-22 22:25:11 +00:00
Guido van Rossum e9eec54798 Fix typo in error checking spotted by Just... 1997-05-22 14:02:25 +00:00
Guido van Rossum 789a1613a0 Add optional 'sizehint' argument to readlines(). After approximately
this many bytes have been read, readlines stops.  Because of
buffering, the amount of bytes read is usually at least 8K more than
the hint.

Also changed read() and readline() to use PyArg_ParseTuple().

(Note that the *previous* checkin also fixed error handling and
narrowed the range of thread unblocking for all methods using
fread().)
1997-05-10 22:33:55 +00:00
Guido van Rossum 6263d5451c Rewrite readlines() to speed it up -- about a factor of 2 on my
Indigo2, reading a 9Meg file from the local disk.
1997-05-10 22:07:25 +00:00
Guido van Rossum 5449b6e123 Speed up read() (i.e. read till EOF) considerably by doing a stat() to
see if we can guess the #bytes until the end of the file.  If we
can't, increment the buffer size increments up to 0.5Meg to avoid
realloc'ing too much.
1997-05-09 22:27:31 +00:00
Guido van Rossum b819914263 Fix by Mark Hammond to enable truncate() on Windows. 1997-05-06 15:23:24 +00:00
Guido van Rossum fdf95dd525 Checkin of Jack's buffer mods.
Not really checked, but didn't fail any tests either...
1997-05-05 22:15:02 +00:00
Guido van Rossum c0b618a2cc Quickly renamed the last directory. 1997-05-02 03:12:38 +00:00
Guido van Rossum 685a38ea94 Make gcc -Wall happy. 1996-12-05 21:54:17 +00:00
Guido van Rossum d266eb460e New permission notice, includes CNRI. 1996-10-25 14:44:06 +00:00
Guido van Rossum d3f9a1ad83 fix read(0), readline(0); make tuple for call_object args 1995-07-10 23:32:26 +00:00
Jack Jansen e08dea19c2 MW does not always set errno on failing fopen() 1995-04-23 22:12:47 +00:00
Guido van Rossum 295d171650 explicitly init flags in methodlists 1995-02-19 15:55:19 +00:00
Guido van Rossum 6610ad9d6b Added 1995 to copyright message.
floatobject.c: fix hash().
methodobject.c: support METH_FREENAME flag bit.
1995-01-04 19:07:38 +00:00
Guido van Rossum d7047b395e Lots of minor changes. Note for mappingobject.c: the hash table pointer
can now be NULL.
1995-01-02 19:07:15 +00:00
Guido van Rossum b6775db241 Merge alpha100 branch back to main trunk 1994-08-01 11:34:53 +00:00
Guido van Rossum c600411755 * mpzmodule.c: removed redundant mpz_print function.
* object.[ch], bltinmodule.c, fileobject.c: changed str() to call
  strobject() which calls an object's __str__ method if it has one.
  strobject() is also called by writeobject() when PRINT_RAW is passed.
* ceval.c: rationalize code for PRINT_ITEM (no change in function!)
* funcobject.c, codeobject.c: added compare and hash functionality.
  Functions with identical code objects and the same global dictionary are
  equal.  Code objects are equal when their code, constants list and names
  list are identical (i.e. the filename and code name don't count).
  (hash doesn't work yet since the constants are in a list and lists can't
  be hashed -- suppose this should really be done with a tuple now we have
  resizetuple!)
1993-11-05 10:22:19 +00:00
Guido van Rossum 82d410e733 * fileobject.c (softspace): fix bug if called with NULL file. 1993-11-01 16:26:16 +00:00
Guido van Rossum 5a2a683e72 * filemodule.c: added writelines() -- analogous to readlines()
* import.c: fixed core dump when out-of-date .pyc file encountered (again!)
1993-10-25 09:59:04 +00:00
Guido van Rossum db3165e655 * bltinmodule.c: removed exec() built-in function.
* Grammar: add exec statement; allow testlist in expr statement.
* ceval.c, compile.c, opcode.h: support exec statement;
  avoid optimizing locals when it is used
* fileobject.{c,h}: add getfilename() internal function.
1993-10-18 17:06:59 +00:00
Guido van Rossum f1dc566328 * Makefile: added all: and default: targets.
* many files: made some functions static; removed "extern int errno;".
* frozenmain.c: fixed bugs introduced on 24 June...
* flmodule.c: remove 1.5 bw compat hacks, add new functions in 2.2a
  (and some old functions that were omitted).
* timemodule.c: added MSDOS floatsleep version .
* pgenmain.c: changed exit() to goaway() and added defn of goaway().
* intrcheck.c: add hack (to UNIX only) so interrupting 3 times
  will exit from a hanging program.  The second interrupt prints
  a message explaining this to the user.
1993-07-05 10:31:29 +00:00
Guido van Rossum 234f942aef * Added gmtime/localtime/mktime and SYSV timezone globals to timemodule.c.
Added $(SYSDEF) to its build rule in Makefile.
* cgensupport.[ch], modsupport.[ch]: removed some old stuff.  Also
  changed files that still used it...  And made several things static
  that weren't but should have been...  And other minor cleanups...
* listobject.[ch]: add external interfaces {set,get}listslice
* socketmodule.c: fix bugs in new send() argument parsing.
* sunaudiodevmodule.c: added flush() and close().
1993-06-17 12:35:49 +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
Guido van Rossum e35399ea7b Checking in last-minute changes that are already part of release 0.9.8 1993-01-10 18:33:56 +00:00
Guido van Rossum de788b8261 fileobject.c: fix nasty bug; Makefile; turn on STROP and change lint flags. 1992-12-22 14:24:04 +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 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 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 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 bab9d03855 Copyright for 1992 added 1992-04-05 14:26:55 +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 201be057fb Added message to EOFError. 1991-12-24 13:26:41 +00:00
Guido van Rossum 87e7ea72a6 Use new exceptions. 1991-12-10 14:00:03 +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 18a372f04c getlonglongargs --> getlonglongarg 1991-09-10 14:55:58 +00:00
Guido van Rossum 909336104b printobject now returns an error code 1991-06-07 16:10:43 +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 76ad8ed51d Call clearerr() after EOF seen. 1991-06-03 10:54:55 +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 eb183da74f Added 'softspace' interface to replace 'needspace' printing hack. 1991-04-04 10:44:06 +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 59b3590711 Think C 4.0 fixes a bug in 3.0 that we programmed around. 1991-01-02 13:51:41 +00:00