Commit Graph

372 Commits

Author SHA1 Message Date
Guido van Rossum b18618dab7 Vladimir Marangozov's long-awaited malloc restructuring.
For more comments, read the patches@python.org archives.
For documentation read the comments in mymalloc.h and objimpl.h.

(This is not exactly what Vladimir posted to the patches list; I've
made a few changes, and Vladimir sent me a fix in private email for a
problem that only occurs in debug mode.  I'm also holding back on his
change to main.c, which seems unnecessary to me.)
2000-05-03 23:44:39 +00:00
Barry Warsaw ee98e4e75d Ignore a bunch of generated files. 2000-05-02 18:34:30 +00:00
Guido van Rossum 6c981ad25e Only write message about changed Tab size with -v. 2000-04-03 23:02:17 +00:00
Guido van Rossum ab5ca15f94 Fix by Eric Raymond: make the code that looks for various bits of
tab-setting magic much smarter, more correct, and more easily
extensible.
2000-03-31 00:52:27 +00:00
Guido van Rossum 86016cb482 Marc-Andre Lemburg: add new string token types u"..." and ur"..."
(Unicode and raw Unicode).
2000-03-10 22:56:54 +00:00
Guido van Rossum 89ce454498 Make sure that -t and -tt also work on strings passed to compile(). 1998-12-21 18:32:40 +00:00
Guido van Rossum d5516bc45f One more fprintf bites the dist -- use PySys_WriteStderr 1998-12-04 18:51:01 +00:00
Guido van Rossum f261526423 Need to add default decl of DL_IMPORT, for mymalloc.h 1998-12-04 18:50:20 +00:00
Guido van Rossum 2a570049ac Changes to deal with the sigcheck+intrcheck vs. signalmodule controversy. 1998-10-07 22:51:56 +00:00
Guido van Rossum 80c7bcf667 The previous fix was still broken; the Py_END_ALLOW_THREADS macro was
never executed because of a return statement.  Sigh.
1998-08-29 16:03:27 +00:00
Guido van Rossum 8efa47b63e We now assume that PyOS_Readline() is called with the interpreter lock
held.  It releases the lock around the call to the function pointed to by
PyOS_ReadlineFunctionPointer (default PyOS_StdioReadline()).
1998-08-27 19:43:43 +00:00
Guido van Rossum 6e73bf4032 Replace all calls to fprintf(stderr, ...) with PySys_WriteStderr(...). 1998-08-25 18:13:04 +00:00
Guido van Rossum 47fbc4049e Add a version of PySys_WriteStderr() that writes to stderr, so we can
use it in tokenizer.c.
1998-08-25 18:12:36 +00:00
Guido van Rossum c3e3e6486f There's a bunch of files that shouldn't be included in libpython*.a! 1998-08-09 03:55:31 +00:00
Guido van Rossum bb3649e2ba Make new gcc -Wall happy 1998-04-10 22:09:39 +00:00
Guido van Rossum 6135df6626 Declare and use Py_TabcheckFlag here. 1998-04-10 19:35:06 +00:00
Guido van Rossum c095200783 Add dummy Py_VerboseFlag now that it's referenced in parsetok.c. 1998-04-10 19:34:15 +00:00
Guido van Rossum 926f13a081 Add checking for inconsistent tab usage 1998-04-09 21:38:06 +00:00
Guido van Rossum f2da4ed48b Add $(LIBS) to the pgen link line. 1998-04-09 19:10:38 +00:00
Guido van Rossum 54758fa8ca Swap two statements in the dedent check loop. This makes absolutely
no difference, but avoids triggering an optimizer bug in the AIX
compiler where the loop unrolling does the wrong thing...
1998-02-16 22:18:00 +00:00
Guido van Rossum 35685240a9 Fixed the bug in searching for triple quotes -- change the 'quote2'
variable from a pointer to an index, so a realloc() of the buffer
won't disturb it.  Problem found by Vladimir Marangozov.
1998-02-16 15:42:50 +00:00
Guido van Rossum cf57d8b8c9 tok_nextc() should return unsigned characters, to avoid mistaking
'\377' for EOF.
1998-01-19 22:07:46 +00:00
Guido van Rossum 7bf22de753 Patch for QNX, by Chris Herborth. 1997-12-02 20:34:19 +00:00
Guido van Rossum 359bcaa539 This fix (across 4 files in 3 directories) solves a subtle problem with
signal handlers in a fork()ed child process when Python is compiled with
thread support.  The bug was reported by Scott <scott@chronis.icgroup.com>.

What happens is that after a fork(), the variables used by the signal
module to determine whether this is the main thread or not are bogus,
and it decides that no thread is the main thread, so no signals will
be delivered.

The solution is the addition of PyOS_AfterFork(), which fixes the signal
module's variables.  A dummy version of the function is present in the
intrcheck.c source file which is linked when the signal module is not
used.
1997-11-14 22:24:28 +00:00
Guido van Rossum 44620646fd Renamed Py_input_hook to PyOS_InputHook.
Also cleaned out some CR's left by the VC++ editor.
1997-08-11 18:57:29 +00:00
Guido van Rossum 717c6f95be Move GNU readline interface to ../Modules/readline.c.
Add Py_input_hook (used by _tkinter and perhaps Gist).
1997-08-05 21:28:12 +00:00
Guido van Rossum aee094cc60 Added finalization routines. 1997-08-02 03:02:27 +00:00
Guido van Rossum ff0ec52d3c Finally plug the memory leak caused by syntax error (including
interactive EOF, which leaked *one* byte).
1997-07-27 01:52:50 +00:00
Guido van Rossum f6ca6aa869 New build procedure. 1997-07-19 19:39:57 +00:00
Guido van Rossum ee2373b930 Oops, missed some renamings. 1997-05-07 23:51:07 +00:00
Guido van Rossum 86bea46b3d Another directory quickly renamed. 1997-04-29 21:03:06 +00:00
Guido van Rossum 5026cb4dc6 Now that the string-sig has settled on r"obin" strings, restrict the
<letter><string> notation to 'r' and 'R'.
1997-04-25 17:32:00 +00:00
Guido van Rossum 2d45be1366 (Jack:) On the Mac, give syntax error on \r. 1997-04-11 19:16:25 +00:00
Guido van Rossum fa658ce03d Remove two unised variables. 1997-04-09 18:19:39 +00:00
Guido van Rossum 24dacb38c5 Support for alternative string quotes (a"xx", b"xx", c"xx", ...). 1997-04-06 03:46:20 +00:00
Guido van Rossum 6dacd90a83 Allow leading underscore in keywords. 1997-04-02 05:23:46 +00:00
Guido van Rossum fbd64c8790 Restructured quite a bit, hopefully Lee Busby will find this useful.
Also grandly renamed.

Here's the new interface:

When WITH_READLINE is defined, two functions are defined:

  - PyOS_GnuReadline (what used to be my_readline() with WITH_READLINE)
  - PyOS_ReadlineInit (for Dave Ascher)

Always, these functions are defined:

  - PyOS_StdioReadline (what used to be my_readline() without WITH_READLINE)
  - PyOS_Readline (the interface used by tokenizer.c and [raw_]input().

There's a global function pointer PyOS_ReadlineFunctionPointer,
initialized to NULL.  When PyOS_Readline finds this to be NULL, it
sets it to either PyOS_GnuReadline or PyOS_StdioReadline depending on
which one makes more sense (i.e. it uses GNU only if it is defined
*and* stdin is indeed a tty device).

An embedding program that has its own wishes can set the function
pointer to a function of its own design.  It should take a char*
prompt argument (which may be NULL) and return a string *ending in a
\n character* -- or "" for EOF or NULL for a user interrupt.

--Guido van Rossum (home page: http://www.python.org/~guido/)
1997-02-18 21:53:32 +00:00
Guido van Rossum bae95189b0 Added decl for Py_AddPendingCall and include mymalloc.h, all to keep
lint happy.
1997-02-14 21:12:24 +00:00
Guido van Rossum ad74fa6674 In the Unix version, arrange for sigcheck() to be called via
Py_AddPendingCall().  This avoids having to call sigcheck() in the
ticker code in ceval.c's main interpreter loop.
1997-01-21 06:00:33 +00:00
Guido van Rossum 408027ea46 Rename DEBUG macro to Py_DEBUG 1996-12-30 16:17:54 +00:00
Guido van Rossum fd8a393086 Make gcc -Wall happy 1996-12-02 18:27:33 +00:00
Guido van Rossum d266eb460e New permission notice, includes CNRI. 1996-10-25 14:44:06 +00:00
Guido van Rossum 0bc253dba7 Explicitly call rl_initialize().
Set rl_readline_name to python.
Move extern decls to more logical point.
1996-09-13 04:09:26 +00:00
Guido van Rossum 7cf1fcf347 Always include config.h 1996-08-19 22:12:39 +00:00
Guido van Rossum 9ea917ebaa Only define PyOS_ReadlineInit if WITH_READLINE defined. 1996-05-24 20:44:12 +00:00
Guido van Rossum adf876938a Separate readline initialization into new function PyOS_ReadlineInit().
For Dave Ascher's readline extensions.
1996-04-09 02:45:31 +00:00
Guido van Rossum faa436c70b use only j for imaginary constants 1996-01-26 18:59:07 +00:00
Guido van Rossum f595fde47b changes for pow(**) and complex 1996-01-12 01:31:58 +00:00
Guido van Rossum c7fea2feed add sigrelse() call for SunOS 4.1; add some fflush() calls 1996-01-12 01:30:55 +00:00
Guido van Rossum 3f6bb86593 fix bogus resize length in nextc 1995-09-21 20:36:34 +00:00
Guido van Rossum 94d32b18e0 ignore control-l in whitespace 1995-07-07 22:27:27 +00:00
Guido van Rossum 2e96eb9266 replace "\r\n" with "\n" at line end (Jim Ahlstrom) 1995-06-14 18:26:02 +00:00
Guido van Rossum 575d561c65 added PyErr_SetInterrupt() 1995-03-10 15:13:03 +00:00
Guido van Rossum d09b41bf05 remove last bits of mac specific code 1995-01-30 12:55:22 +00:00
Jack Jansen 9fc3989c66 Mac interrupt code moved to macglue.c 1995-01-27 14:40:41 +00:00
Jack Jansen 51f4b8dc78 New cmd-. handling for the mac. 1995-01-26 16:20:38 +00:00
Guido van Rossum ec4982761b fix strncpy call (uninitialized memory read) 1995-01-20 16:59:12 +00:00
Guido van Rossum badadd2165 typo 1995-01-20 16:58:43 +00:00
Jack Jansen febf811a2d Added mac-only intrpeek routine that peeks for command-. 1995-01-19 12:12:36 +00:00
Guido van Rossum 78c0535a22 fix loop on unterminated triple quotes 1995-01-17 16:12:13 +00:00
Guido van Rossum 62e376b164 made interrupted static again 1995-01-17 16:11:53 +00:00
Guido van Rossum 087579ea51 added $& to $(LIB) target for Sequent 1995-01-17 16:11:29 +00:00
Guido van Rossum b9f8d6e54d Added 1995 to copyright message. 1995-01-04 19:08:09 +00:00
Guido van Rossum 5799b52008 Added 1995 copyright.
object.h: made sizes and refcnts signed ints.
stringobject.h: make getstrsize() signed int.
methodobject.h: add METH_VARARGS and METH_FREENAME flag bit definitions.
1995-01-04 19:06:22 +00:00
Guido van Rossum 588633daa2 Parser/tokenizer.c (tok_nextc): zap tok->buf after freeing;
rest: abort() -> fatal(); small things
1994-12-30 15:46:02 +00:00
Guido van Rossum 2929527aed * Parser/intrcheck.c: make 'interrupted' global (forgot for
whom...)
1994-09-28 15:46:03 +00:00
Guido van Rossum 1a817c0911 * Parser/tokenizer.c (tok_nextc): count line numbers when parsing
strings
1994-09-19 08:06:25 +00:00
Guido van Rossum 6522eb0400 * Parser/grammar1.c (finddfa): massive speed up by using direct
addressing instead of searching
1994-09-09 11:11:39 +00:00
Guido van Rossum 1d5735e846 Merge back to main trunk 1994-08-30 08:27:36 +00:00
Guido van Rossum f4b1a64a21 * Parser/tokenizer.c: backup over illegal newline in string
literal (for "completeness" test)
1994-08-29 12:43:07 +00:00
Guido van Rossum bd0389d5fd don't call strncpy(str, NULL, 0) 1994-08-29 12:25:45 +00:00
Guido van Rossum 0e3da7ba50 Makefile: add $(OPT) to linking line
tokenizer.c: move tok_backup call around
1994-08-29 10:44:10 +00:00
Guido van Rossum d250ee2413 * Parser/tokenizer.c: backup over illegal newline in string
literal (for "completeness" test)
	* */Makefile*.in: remove lib*.a before adding to it
1994-08-23 13:38:57 +00:00
Guido van Rossum b6775db241 Merge alpha100 branch back to main trunk 1994-08-01 11:34:53 +00:00
Guido van Rossum 6fa6343f0e None 1993-12-24 10:36:57 +00:00
Guido van Rossum 248a50c168 * Grammar: corrected old typo (class instead of 'class')
* dosmodule.c: MSDOS specific stuff from posixmodule.c.
* posixmodule.c: removed all MSDOS specific stuff.
* tokenizer.h, parsetok.h: in prototypes, don't mix named and unnamed
  parameters (MSC doesn't like this).
1993-12-20 12:53:10 +00:00
Guido van Rossum badac73dfc New file 1993-12-20 10:52:46 +00:00
Guido van Rossum b73cc04e62 * ceval.c, longobject.c, methodobject.c, listnode.c, arraymodule.c,
pythonrun.c: added static forward declarations
* pythonrun.h, ceval.h, longobject.h, node.h: removed declarations of
  static routines
1993-11-01 16:28:59 +00:00
Guido van Rossum 8054fad890 Changes to accept double-quoted strings on input. 1993-10-26 15:19:44 +00:00
Guido van Rossum a3309960a5 * Added support for X11 modules.
* Makefile: change location of FORMS library.
* posixmodule.c: turn #if 0 into #ifdef MSDOS (stuff in unistd.h or not)
* Almost all .h files: added CPP magic to avoid duplicate inclusions and
  to support inclusion from C++.
1993-07-28 09:05:47 +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 9e90a672b4 * pythonmain.c: -k option, usage message, more environment flags.
(the latter also in frozenmain.c)
* ceval.c: global 'killprint' flag raises exception when printing an
  expression statement's value (useful for finding stray output)
* timemodule.c: add asctime() and ctime().  Change julian date to
  1-based origin (as intended and documented).
* Removed unused DO_TIMES stuff from timemodule.c.  Added 'epoch' and
  'day0' globals (year where time.time() == 0 and day of the week the
  epoch started).
1993-06-24 11:10:19 +00:00
Guido van Rossum a849b834f1 * selectmodule.c: fix (another!) two memory leaks -- this time in list2set
* tokenizer.[ch]: allow continuation without \ inside () [] {}.
1993-05-12 11:35:44 +00:00
Guido van Rossum 6ac258d381 * pythonrun.c: Print exception type+arg *after* stack trace instead of
before it.
* ceval.c, object.c: moved testbool() to object.c (now extern visible)
* stringobject.c: fix bugs in and rationalize string resize in formatstring()
* tokenizer.[ch]: fix non-working code for lines longer than BUFSIZ
1993-05-12 08:24:20 +00:00
Guido van Rossum acbe8da4f8 (I suggest a recompile after getting this, the ceval.c bugfix may be crucial!)
* Makefile: removed superfluous AR=ar, fixed misleading comment.
* ceval.c: fixed debugging code; save/restore errors in locals_2_fast.
* intrcheck.c: for SunOS etc., turn off syscall resumption.
* regexpr.h: bump number of registers to 100.
1993-04-15 15:33:52 +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 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 cf7448bfa0 Correct debug printing code 1992-09-03 20:46:37 +00:00
Guido van Rossum 888d205fff Print warnings to stderr and correct spelling 1992-09-03 20:45:24 +00:00
Guido van Rossum bab9d03855 Copyright for 1992 added 1992-04-05 14:26:55 +00:00
Guido van Rossum 5113f5fd34 Copyright for 1992 added 1992-04-05 14:20:22 +00:00
Guido van Rossum 7ebb23c637 Added guesstabsize() for the mac 1992-03-27 17:31:35 +00:00
Guido van Rossum df840d911f lint 1992-03-27 17:29:44 +00:00
Guido van Rossum 9abc539846 Lint fluff 1992-03-27 17:24:37 +00:00
Guido van Rossum 91ece4205b Guess tab size on the Mac from tab resource. 1992-03-25 22:32:00 +00:00
Guido van Rossum d8b1d37bd8 Append a NEWLINE token at the end of a file. 1992-03-04 16:40:44 +00:00
Guido van Rossum 4fe872988b Make tabs always 8 spaces wide -- it's more portable. 1992-02-26 15:24:44 +00:00
Guido van Rossum 189e8f9380 Added a header file. 1992-01-19 16:29:05 +00:00
Guido van Rossum 943094566a Add warning XXX that 09.9 isn't accepted. 1991-12-10 14:01:05 +00:00
Guido van Rossum baf0ebf43c Added shift and mask ops.
Allow numbers starting with a period.
1991-10-24 14:59:40 +00:00
Guido van Rossum fbab905ae1 Added 2-char tokens and new versions of comparisons 1991-10-20 20:25:03 +00:00
Guido van Rossum c64d04dedd Implemented 2-character operators. 1991-10-20 20:20:00 +00:00
Guido van Rossum 7d8b509575 Added work-arounds for MPW 3.{1,2?} code generation bug. 1991-09-10 14:53:39 +00:00
Guido van Rossum 8c11a5c759 Completely ignore lines with only a newline token on them, except
wholly empty lines interactively.
1991-07-27 21:42:56 +00:00
Guido van Rossum 1055ecebee Reorganized somewhat to make it really work on Think C.
Hope the best for MPW 3.
1991-07-01 18:46:03 +00:00
Guido van Rossum d6a15ada72 Generalize to macintosh. 1991-06-24 22:30:42 +00:00
Guido van Rossum 56b07c8ad9 When printing an error message, don't choke if tok->buf is NULL. 1991-06-07 13:58:56 +00:00
Guido van Rossum 326f582763 Don't print the line number for syntax errors in string parsing. 1991-06-03 11:02:09 +00:00
Guido van Rossum f023c463d7 Added recognition of 'l' or 'L' as long integer suffix 1991-05-05 20:16:20 +00:00
Guido van Rossum 324aa79f66 Add declaration of struct _node, for scoping reasons. 1991-04-04 15:44:12 +00:00
Guido van Rossum 71f477c797 Added forward declarations. 1991-04-03 19:09:02 +00:00
Guido van Rossum f70e43a073 Added copyright notice. 1991-02-19 12:39:46 +00:00
Guido van Rossum 875eb7d9c2 Mac version now looks ahead in event queue instead of eating events.
Much better!
1991-01-16 14:04:51 +00:00
Guido van Rossum b156d7259b Changes for THINK C 4.0. 1990-12-20 23:13:00 +00:00
Guido van Rossum 706eea8a06 Changess for THINK C 4.0. 1990-12-20 23:11:02 +00:00
Guido van Rossum 3f5da24ea3 "Compiling" version 1990-12-20 15:06:42 +00:00
Guido van Rossum 840bcf11a8 Set parse tree in parser data structure to NULL when returning
a valid parse tree to caller, so caller must free the tree.
1990-11-18 17:39:41 +00:00
Guido van Rossum 99f02d43f3 Free parse tree when deleting parser. 1990-11-18 17:38:42 +00:00
Guido van Rossum 03a24cd47b Add function to free an entire parse tree. 1990-11-18 17:37:06 +00:00
Guido van Rossum a769172f6a Increment line number for continuation lines. 1990-11-09 15:08:39 +00:00
Guido van Rossum 85a5fbbdfe Initial revision 1990-10-14 12:07:46 +00:00