summaryrefslogtreecommitdiffstats
path: root/Python/sysmodule.c
Commit message (Collapse)AuthorAgeFilesLines
* Include sys_getdefaultencoding in #ifdef Py_USING_UNICODE. Fixes #479571.Martin v. Löwis2001-11-091-2/+2
|
* Convert getrefcount() to METH_O, and sys_excepthook() to useFred Drake2001-10-241-6/+3
| | | | PyArg_UnpackTuple().
* Rationalize the events passed to the profiler (no changes for the tracer).Fred Drake2001-10-041-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | The profiler does not need to know anything about the exception state, so we no longer call it when an exception is raised. We do, however, make sure we *always* call the profiler when we exit a frame. This ensures that timing events are more easily isolated by a profiler and finally clauses that do a lot of work don't have their time mis-allocated. When an exception is propogated out of the frame, the C callback for the profiler now receives a PyTrace_RETURN event with an arg of NULL; the Python-level profile hook function will see a 'return' event with an arg of None. This means that from Python it is impossible for the profiler to determine if the frame exited with an exception or if it returned None, but this doesn't matter for profiling. A C-based profiler could tell the difference, but this doesn't seem important. ceval.c:eval_frame(): Simplify the code in two places so that the profiler is called for every exit from a frame and not for exceptions. sysmodule.c:profile_trampoline(): Make sure we don't expose Python code to NULL; use None instead.
* Patch #445762: Support --disable-unicodeMartin v. Löwis2001-08-171-0/+10
| | | | | | | | - Do not compile unicodeobject, unicodectype, and unicodedata if Unicode is disabled - check for Py_USING_UNICODE in all places that use Unicode functions - disables unicode literals, and the builtin functions - add the types.StringTypes list - remove Unicode literals from most tests.
* Patch #427190: Implement and use METH_NOARGS and METH_O.Martin v. Löwis2001-08-161-45/+29
|
* Patch number #422106 by Greg Ball, to fix segmentationMoshe Zadka2001-07-231-0/+5
| | | | | | | fault in sys.displayhook. Please check this in on the 2.2a1 branch (or whatever is necessary to get it working next release)
* Patch #412229: Add functions sys.getdlopenflags and sys.setdlopenflags.Martin v. Löwis2001-07-181-0/+52
| | | | Add dlopenflags to PyInterpreterState, and use it in dlopen calls.
* Revise the interface to the profiling and tracing support for theFred Drake2001-06-271-13/+110
| | | | | | | | | | | | | | | | | | Python interpreter. This change adds two new C-level APIs: PyEval_SetProfile() and PyEval_SetTrace(). These can be used to install profile and trace functions implemented in C, which can operate at much higher speeds than Python-based functions. The overhead for calling a C-based profile function is a very small fraction of a percent of the overhead involved in calling a Python-based function. The machinery required to call a Python-based profile or trace function been moved to sysmodule.c, where sys.setprofile() and sys.setprofile() simply become users of the new interface. As a side effect, SF bug #436058 is fixed; there is no longer a _PyTrace_Init() function to declare.
* Encode surrogates in UTF-8 even for a wide Py_UNICODE.Martin v. Löwis2001-06-271-0/+4
| | | | | | | Implement sys.maxunicode. Explicitly wrap around upper/lower computations for wide Py_UNICODE. When decoding large characters with UTF-8, represent expected test results using the \U notation.
* Instead of initializing & interning the strings passed to the profileFred Drake2001-06-161-0/+6
| | | | | | | and trace functions lazily, which incurs extra argument pushing and checks in the C overhead for profiling/tracing, create the strings semi-lazily when the Python code first registers a profile or trace function. This simplifies the trampoline into the profile/trace functions.
* Updated version of RISCOS support. SF patch 411213 by Dietmar SchwertbergerGuido van Rossum2001-04-101-0/+4
|
* Add sys.excepthook.Ka-Ping Yee2001-03-231-11/+47
| | | | | | | | Update docstring and library reference section on 'sys' module. New API PyErr_Display, just for displaying errors, called by excepthook. Uncaught exceptions now call sys.excepthook; if that fails, we fall back to calling PyErr_Display directly. Also comes with sys.__excepthook__ and sys.__displayhook__.
* Neil discovered a bad DECREF on warnoptions, that caused repeatedGuido van Rossum2001-01-131-2/+1
| | | | | | re-initializing Python (Py_Finalize() followed by Py_Initialize()) to blow up quickly. With the DECREF removed I can't get it to fail any more. (Except it still leaks, but that's probably a separate issue.)
* stdout is sometimes a macro; use "outf" instead.Greg Stein2001-01-111-5/+5
| | | | Submitted by: Mark Favas <m.favas@per.dem.csiro.au>
* Implementation of PEP-0217.Moshe Zadka2001-01-111-0/+46
| | | | This closes the PEP, and patch 103170
* Add definitions for PySys_ResetWarnOptions() andGuido van Rossum2000-12-151-0/+39
| | | | PySys_AddWarnOption().
* _getframe(): New sys module function for getting at the stack frame.Barry Warsaw2000-12-061-0/+37
| | | | | Implements and closes SF patch #102106, with Guido's suggested documentation changes.
* REMOVED all CWI, CNRI and BeOpen copyright markings.Guido van Rossum2000-09-011-9/+0
| | | | This should match the situation in the 1.6b1 tree.
* add user-modifiable recursion_limitJeremy Hylton2000-08-311-3/+51
| | | | | | | | | | | ceval.c: define recurion_limit (static), default value is 2500 define Py_GetRecursionLimit and Py_SetRecursionLimit raise RuntimeError if limit is exceeded PC/config.h: remove plat-specific definition sysmodule.c: add sys.(get|set)recursionlimit
* _PySys_Init(): When setting up sys.version_info, use #if/#elif.../#endifFred Drake2000-08-311-6/+3
| | | | | instead of four #if/#endif blocks. This shortens the code and improves readability.
* _PySys_Init(): Fix another Insure discovered memory leak; the PyStringBarry Warsaw2000-08-161-1/+2
| | | | created from the "big"/"little" constant needs to be decref'd.
* Guido pointed out that all names in the sys module have no underscore,Fred Drake2000-08-151-4/+5
|
* The attempt to protect against MS_WIN16 compilers that do not support longFred Drake2000-08-141-1/+2
| | | | | | string literals has not been tested on an MS_WIN16 platform; the trailing ";" was inside the #ifndef MS_WIN16, which should cause an error (missing semi-colon) when compiled with that symbol #defined.
* Add a byte_order value to the sys module. The value is "big" forFred Drake2000-08-141-0/+13
| | | | big-endian machines and "little" for little-endian machines.
* Create a new section of pyport.h to hold all external function declarationsThomas Wouters2000-07-241-1/+0
| | | | | | | | | | | | | | for systems that are missing those declarations from system include files. Start by moving a pointy-haired ones from their previous locations to the new section. (The gethostname() one, for instance, breaks on several systems, because some define it as (char *, size_t) and some as (char *, int).) I purposely decided not to include the summary of used #defines like Tim did in the first section of pyport.h. In my opinion, the number of #defines likedly to be used by this section would make such an overview unwieldy. I would suggest documenting the non-obvious ones, though.
* Mass ANSIfication of function definitions. Doesn't cover all 'extern'Thomas Wouters2000-07-221-77/+20
| | | | declarations yet, those come later.
* Nuke all remaining occurrences of Py_PROTO and Py_FPROTO.Tim Peters2000-07-091-4/+4
|
* Change copyright notice - 2nd try.Guido van Rossum2000-06-301-6/+0
|
* Change copyright notice.Guido van Rossum2000-06-301-22/+7
|
* Trent Mick's Win64 changes: size_t vs. int or long; also some overflowGuido van Rossum2000-06-281-1/+1
| | | | tests.
* Added a new debug method sys.gettotalrefcount(), which returns the total ↵Mark Hammond2000-06-201-1/+14
| | | | | | number of references on all Python objects. This is only enabled when Py_TRACE_REFS is defined (which includes default debug builds under Windows). Also removed a redundant cast from sys.getrefcount(), as discussed on the patches list.
* Marc-Andre Lemburg <mal@lemburg.com>:Marc-André Lemburg2000-06-071-10/+10
| | | | | | Changed the API names for setting the default encoding. These are now in line with the other hooks API names (no underscores).
* M.-A. Lemburg <mal@lemburg.com>:Fred Drake2000-05-091-0/+37
| | | | | | Added APIs to allow setting and querying the system's current string encoding: sys.set_string_encoding() and sys.get_string_encoding().
* Simplify creation of the version_info value for clarity, perFred Drake2000-04-131-6/+7
| | | | suggestion from Greg Stein.
* Capitulate, changing version_info to a 5-tuple:Fred Drake2000-04-131-12/+18
| | | | | | major, minor, micro, level, serial Values are now monotonically increasing with each new release.
* Define version_info to be a tuple (major, minor, micro, level); levelFred Drake2000-04-131-1/+19
| | | | | | is a string "a2", "b1", "c1", or '' for a final release. Added version_info and hexversion to the module docstring.
* Use modern PyArg_ParseTuple style, with function names.Guido van Rossum2000-03-311-8/+8
| | | | (Mostly.)
* Massive patch by Skip Montanaro to add ":name" to as manyGuido van Rossum2000-02-291-1/+1
| | | | PyArg_ParseTuple() format string arguments as possible.
* In PySys_GetObject(), it's possible that tstate->interp->sysdict isGuido van Rossum1999-10-051-0/+2
| | | | | | NULL. In that case, return NULL rather than dumping core. This fixes PR#91, submitted by Lele Gaifax.
* _PySys_Init(): Nailed small memory leak. The stringobject created forBarry Warsaw1999-01-271-0/+1
| | | | sys.version was missing a Py_XDECREF().
* Jim Ahlstrom patch: the module doc string is too long for 16-bit VCGuido van Rossum1999-01-141-1/+5
| | | | 1.5. Omit the second part.
* Add sys.hexversion, which is an integer encoding the version in hexadecimal.Guido van Rossum1999-01-031-0/+2
| | | | | | 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?)
* Patches for mywrite() by Marc Lemburg: save/restore the error stateGuido van Rossum1998-10-121-3/+6
| | | | reliably; check return value of vsprintf().
* Gack. The module doc string is too long for VC++ 5.0.Guido van Rossum1998-08-061-2/+5
| | | | | However two string literals concatenated are fine! Hope this doesn't break other platforms.
* Added doc strings. Maybe the doc string for the module itself is a bitGuido van Rossum1998-06-271-7/+102
| | | | long, but it sure helps!
* New APIs to write to sys.stdout or sys.stderr using a printf-like interface.Guido van Rossum1998-05-121-0/+90
| | | | | | | | | | | | | | | | | | | | | | | | 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.
* Make backup copies of stdin, stdout, stderr as __stdin__, __stdout__,Guido van Rossum1998-02-191-0/+4
| | | | __stderr__. These will be used by the import cleanup.
* Get rid of another reference to _PyImport_Inittab (now a static array)Guido van Rossum1997-11-041-2/+2
| | | | | that should be PyImport_Inittab (a new pointer initialized to point to the array).
* Get DLL version from a variable.Guido van Rossum1997-09-291-1/+3
|
* Remove unised variableGuido van Rossum1997-08-071-1/+0
|