Commit Graph

59 Commits

Author SHA1 Message Date
Barry Warsaw 54892c4b2c _PySys_Init(): Nailed small memory leak. The stringobject created for
sys.version was missing a Py_XDECREF().
1999-01-27 16:33:19 +00:00
Guido van Rossum a71b5f4e1d Jim Ahlstrom patch: the module doc string is too long for 16-bit VC
1.5.  Omit the second part.
1999-01-14 19:07:00 +00:00
Guido van Rossum e0d7dae3b8 Add sys.hexversion, which is an integer encoding the version in hexadecimal.
In other words, hex(sys.hexversion) == 0x010502b2 for Python 1.5.2b2.
This is derived from the new variable PY_VERSION_HEX defined in patchlevel.h.
(Cute, eh?)
1999-01-03 12:55:39 +00:00
Guido van Rossum 8442af35fe Patches for mywrite() by Marc Lemburg: save/restore the error state
reliably; check return value of vsprintf().
1998-10-12 18:22:10 +00:00
Guido van Rossum 40552d0857 Gack. The module doc string is too long for VC++ 5.0.
However two string literals concatenated are fine!
Hope this doesn't break other platforms.
1998-08-06 03:34:39 +00:00
Guido van Rossum c3bc31e249 Added doc strings. Maybe the doc string for the module itself is a bit
long, but it sure helps!
1998-06-27 19:43:25 +00:00
Guido van Rossum a890e68807 New APIs to write to sys.stdout or sys.stderr using a printf-like interface.
Adapted from code submitted by Just van Rossum.

   PySys_WriteStdout(format, ...)
   PySys_WriteStderr(format, ...)

      The first function writes to sys.stdout; the second to sys.stderr.  When
      there is a problem, they write to the real (C level) stdout or stderr;
      no exceptions are raised (but a pending exception may be cleared when a
      new exception is caught).

      Both take a printf-style format string as their first argument followed
      by a variable length argument list determined by the format string.

      *** WARNING ***

      The format should limit the total size of the formatted output string to
      1000 bytes.  In particular, this means that no unrestricted "%s" formats
      should occur; these should be limited using "%.<N>s where <N> is a
      decimal number calculated so that <N> plus the maximum size of other
      formatted text does not exceed 1000 bytes.  Also watch out for "%f",
      which can print hundreds of digits for very large numbers.
1998-05-12 14:59:24 +00:00
Guido van Rossum bd36dbaaa5 Make backup copies of stdin, stdout, stderr as __stdin__, __stdout__,
__stderr__.  These will be used by the import cleanup.
1998-02-19 20:53:06 +00:00
Guido van Rossum 25c649fdf2 Get rid of another reference to _PyImport_Inittab (now a static array)
that should be PyImport_Inittab (a new pointer initialized to point to
the array).
1997-11-04 17:04:34 +00:00
Guido van Rossum 6c1e5f2033 Get DLL version from a variable. 1997-09-29 23:34:23 +00:00
Guido van Rossum 622f73f188 Remove unised variable 1997-08-07 19:22:48 +00:00
Guido van Rossum 25ce566661 The last of the mass checkins for separate (sub)interpreters.
Everything should now work again.

See the comments for the .h files mass checkin (e.g. pystate.h) for
more detail.
1997-08-02 03:10:38 +00:00
Guido van Rossum 534ac094f9 Removed a bunch of extern declarations of functions that are now
properly declared in Python.h.
1997-07-19 19:51:43 +00:00
Guido van Rossum b2c8ec4b75 Set sys.executable to full path of python (from argv[0]). 1997-05-22 20:41:20 +00:00
Guido van Rossum 1254d79dfa Use #ifdef in stead of #if (Jack) 1997-05-20 15:57:25 +00:00
Guido van Rossum a027efa5bf Massive changes for separate thread state management.
All per-thread globals are moved into a struct which is manipulated
separately.
1997-05-05 20:56:21 +00:00
Guido van Rossum bb5c6f8529 Oops, forgot one: inittab. 1997-04-29 20:42:30 +00:00
Guido van Rossum 65bf9f265e Quickly renamed. 1997-04-29 18:33:38 +00:00
Guido van Rossum c474deaaf6 Expand one level of symbolic link in sys.argv[0] before inserting its
dirname in sys.path.  This means that you can create a symbolic link
foo in /usr/local/bin pointing to /usr/yourname/src/foo/foo.py, and
then invoking foo will insert /usr/yourname/src/foo in sys.path, not
/usr/local/bin.  This makes it easier to have multifile programs
(before, the program would have to do an os.readlink(sys.argv[0])
itself and insert the resulting directory in sys.path -- Grail does
this).

Note that the expansion is only used for sys.path; sys.argv[0] is
still the original, unadorned filename (/usr/local/bin/foo in the
example).
1997-04-25 15:38:31 +00:00
Guido van Rossum 43f1b8d6e4 Added optional interface for dynamic execution profile (to be gathered
in ceval.c).
1997-01-24 04:07:45 +00:00
Guido van Rossum 8f49e12a0e Make builtin_module_names a tuple instead of a list. 1997-01-06 22:55:54 +00:00
Guido van Rossum d266eb460e New permission notice, includes CNRI. 1996-10-25 14:44:06 +00:00
Guido van Rossum 9b38a145e2 Rationalized MS ifdefs 1996-09-11 23:12:24 +00:00
Guido van Rossum cc88341e6d Changes to setpythonpath():
Test for / as well as for SEP for MS filenames.
Drop trailing separator from sys.path[0] for MS and Unix filenames.
1996-09-10 14:44:21 +00:00
Guido van Rossum 8b9ea873ad Use MS_DLL_ID as sys.winver 1996-08-23 18:14:47 +00:00
Guido van Rossum 94a9667f1a Always insert script directory in front of sys.path -- if there's no
sys.argv, insert "".  Note that "." is removed as a default component
of the path (see changes to getpath.c and Setup.in).
1996-07-30 20:35:50 +00:00
Guido van Rossum a63d9f4d9f As a side effect of calling PySys_SetArgv (setpythonargv), the
directory containing argv[0] is inserted in front of sys.path.
If argv[0] contains no directory, an empty string is inserted.
If argv is empty, nothing happens.
1996-07-24 01:31:37 +00:00
Guido van Rossum 6f489d989d Slightly different Windows ifdefs 1996-06-28 20:15:15 +00:00
Guido van Rossum 8fa9b6f932 Define sys.prefix and sys.exec_prefix (see Modules/getpath.c; from Makefile). 1996-06-17 17:02:48 +00:00
Guido van Rossum ded690fc35 rename printrefs, getobjects to _Py_ prefix 1996-05-24 20:48:31 +00:00
Guido van Rossum 7f3f2c1819 TRACE_REFS -> Py_TRACE_REFS 1996-05-23 22:45:41 +00:00
Guido van Rossum c606fe186f Under NT, define sys.dllhandle and sys.winver (Mark H.). 1996-04-09 02:37:57 +00:00
Guido van Rossum b0352fa3fc fix args options for setcheckinterval 1996-01-12 01:15:01 +00:00
Sjoerd Mullender 6ec3c653da Implemented two new functions in sys:
getcounts() returns a list of counts of allocations and
		deallocations for all different object types.
	getobjects(n [, type ]) returns a list of recently allocated
		and not-yet-freed objects of the given type (all
		objects if no type given).  Only the n most recent
		(all if n==0) objects are returned.
getcounts is only available if compiled with -DCOUNT_ALLOCS,
getobjects is only available if compiled with -DTRACE_REFS.  Note that
everything must be compiled with these options!
1995-08-29 09:18:14 +00:00
Guido van Rossum aaf18390ee added sys.platform 1995-07-07 22:45:02 +00:00
Guido van Rossum 9a1f388676 init sys_checkinterval to 10 1995-03-30 11:01:58 +00:00
Guido van Rossum cc8914fb22 fix comment about exit() 1995-03-20 15:09:40 +00:00
Guido van Rossum 4f508cc806 add explicit 0 flags for methodlist 1995-02-21 21:03:24 +00:00
Guido van Rossum a0d7a23398 sys.check_interval=x -> sys.setcheckinterval(x) 1995-01-09 17:46:13 +00:00
Guido van Rossum 6d023c98b0 Added 1995 to copyright message.
bltinmodule.c: fixed coerce() nightmare in ternary pow().
modsupport.c (initmodule2): pass METH_FREENAME flag to newmethodobject().
pythonrun.c: move flushline() into and around print_error().
1995-01-04 19:12:13 +00:00
Guido van Rossum 1ae940a587 Lots of changes, most minor (fatal() instead of abort(), use of
err_fetch/err_restore and so on).  But...
NOTE: import.c has been rewritten and all the DL stuff is now in the
new file importdl.c.
1995-01-02 19:04:15 +00:00
Guido van Rossum 1d5735e846 Merge back to main trunk 1994-08-30 08:27:36 +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 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 14b4adbd33 Add an optional interface to turn malloc debugging on and off. 1992-09-03 20:25:30 +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 e765f7dbae Fix reference counts of sys_trace and sys_profile 1992-04-05 14:17:55 +00:00
Guido van Rossum e2437a191d Added settrace() and setprofile(). 1992-03-23 18:20:18 +00:00
Guido van Rossum 5ad58c6aef sysset(name, NULL) does nothing if sys.name is undefined 1992-01-26 18:15:48 +00:00
Guido van Rossum ee3a299c39 Ensure that sys.argv[0] always exists (maybe as empty string). 1992-01-14 18:42:53 +00:00