comparison Python/sysmodule.c @ 44828:ef7d72d98485

Merged revisions 60124-60142 via svnmerge from svn+ssh://pythondev@svn.python.org/python/trunk ........ r60131 | georg.brandl | 2008-01-20 12:13:29 +0100 (Sun, 20 Jan 2008) | 3 lines #1351692: in pprint, always call format() for dict and list items to enable custom formatting of contents via subclassing PrettyPrinter. ........ r60133 | georg.brandl | 2008-01-20 12:43:03 +0100 (Sun, 20 Jan 2008) | 2 lines #1178141: add addinfourl.code to get http status code from urllib. ........ r60134 | georg.brandl | 2008-01-20 13:05:43 +0100 (Sun, 20 Jan 2008) | 4 lines #856047: respect the ``no_proxy`` env var when checking for proxies in urllib and using the other ``_proxy`` env vars. Original patch by Donovan Baarda. ........ r60135 | georg.brandl | 2008-01-20 13:18:17 +0100 (Sun, 20 Jan 2008) | 4 lines #1664522: in urllib, don't read non-existing directories in ftp mode, returning a 0-byte file -- raise an IOError instead. Original patch from Phil Knirsch. ........ r60136 | georg.brandl | 2008-01-20 13:57:47 +0100 (Sun, 20 Jan 2008) | 2 lines #799369: document possible sys.platform values. ........ r60137 | georg.brandl | 2008-01-20 14:08:37 +0100 (Sun, 20 Jan 2008) | 2 lines #652749: document the constants added to the builtins by site.py. ........ r60138 | georg.brandl | 2008-01-20 14:59:46 +0100 (Sun, 20 Jan 2008) | 2 lines #1648: add sys.gettrace() and sys.getprofile(). ........ r60139 | georg.brandl | 2008-01-20 15:17:42 +0100 (Sun, 20 Jan 2008) | 2 lines #1669: don't allow shutil.rmtree() to be called on a symlink. ........ r60140 | georg.brandl | 2008-01-20 15:20:02 +0100 (Sun, 20 Jan 2008) | 2 lines Fix test_pyclbr after urllib change. ........ r60141 | christian.heimes | 2008-01-20 15:28:28 +0100 (Sun, 20 Jan 2008) | 1 line Fixed a wrong assumption in configure.in and Include/pyport.h. The is finite function is not called isfinite() but finite(). Sorry, my fault. :) ........ r60142 | georg.brandl | 2008-01-20 15:31:27 +0100 (Sun, 20 Jan 2008) | 2 lines #1876: fix typos in test_operator. ........
author Christian Heimes <christian@cheimes.de>
date Sun, 20 Jan 2008 15:14:11 +0000
parents 6f049ca55e06
children ebfbaa1051e2
comparison
equal deleted inserted replaced
44816:150cb48edb07 44828:ef7d72d98485
372 Set the global debug tracing function. It will be called on each\n\ 372 Set the global debug tracing function. It will be called on each\n\
373 function call. See the debugger chapter in the library manual." 373 function call. See the debugger chapter in the library manual."
374 ); 374 );
375 375
376 static PyObject * 376 static PyObject *
377 sys_gettrace(PyObject *self, PyObject *args)
378 {
379 PyThreadState *tstate = PyThreadState_GET();
380 PyObject *temp = tstate->c_traceobj;
381
382 if (temp == NULL)
383 temp = Py_None;
384 Py_INCREF(temp);
385 return temp;
386 }
387
388 PyDoc_STRVAR(gettrace_doc,
389 "gettrace()\n\
390 \n\
391 Return the global debug tracing function set with sys.settrace.\n\
392 See the debugger chapter in the library manual."
393 );
394
395 static PyObject *
377 sys_setprofile(PyObject *self, PyObject *args) 396 sys_setprofile(PyObject *self, PyObject *args)
378 { 397 {
379 if (trace_init() == -1) 398 if (trace_init() == -1)
380 return NULL; 399 return NULL;
381 if (args == Py_None) 400 if (args == Py_None)
389 PyDoc_STRVAR(setprofile_doc, 408 PyDoc_STRVAR(setprofile_doc,
390 "setprofile(function)\n\ 409 "setprofile(function)\n\
391 \n\ 410 \n\
392 Set the profiling function. It will be called on each function call\n\ 411 Set the profiling function. It will be called on each function call\n\
393 and return. See the profiler chapter in the library manual." 412 and return. See the profiler chapter in the library manual."
413 );
414
415 static PyObject *
416 sys_getprofile(PyObject *self, PyObject *args)
417 {
418 PyThreadState *tstate = PyThreadState_GET();
419 PyObject *temp = tstate->c_profileobj;
420
421 if (temp == NULL)
422 temp = Py_None;
423 Py_INCREF(temp);
424 return temp;
425 }
426
427 PyDoc_STRVAR(getprofile_doc,
428 "getprofile()\n\
429 \n\
430 Return the profiling function set with sys.setprofile.\n\
431 See the profiler chapter in the library manual."
394 ); 432 );
395 433
396 static PyObject * 434 static PyObject *
397 sys_setcheckinterval(PyObject *self, PyObject *args) 435 sys_setcheckinterval(PyObject *self, PyObject *args)
398 { 436 {
761 #ifdef HAVE_DLOPEN 799 #ifdef HAVE_DLOPEN
762 {"setdlopenflags", sys_setdlopenflags, METH_VARARGS, 800 {"setdlopenflags", sys_setdlopenflags, METH_VARARGS,
763 setdlopenflags_doc}, 801 setdlopenflags_doc},
764 #endif 802 #endif
765 {"setprofile", sys_setprofile, METH_O, setprofile_doc}, 803 {"setprofile", sys_setprofile, METH_O, setprofile_doc},
804 {"getprofile", sys_getprofile, METH_NOARGS, getprofile_doc},
766 {"setrecursionlimit", sys_setrecursionlimit, METH_VARARGS, 805 {"setrecursionlimit", sys_setrecursionlimit, METH_VARARGS,
767 setrecursionlimit_doc}, 806 setrecursionlimit_doc},
768 #ifdef WITH_TSC 807 #ifdef WITH_TSC
769 {"settscdump", sys_settscdump, METH_VARARGS, settscdump_doc}, 808 {"settscdump", sys_settscdump, METH_VARARGS, settscdump_doc},
770 #endif 809 #endif
771 {"settrace", sys_settrace, METH_O, settrace_doc}, 810 {"settrace", sys_settrace, METH_O, settrace_doc},
811 {"gettrace", sys_gettrace, METH_NOARGS, gettrace_doc},
772 {"call_tracing", sys_call_tracing, METH_VARARGS, call_tracing_doc}, 812 {"call_tracing", sys_call_tracing, METH_VARARGS, call_tracing_doc},
773 {NULL, NULL} /* sentinel */ 813 {NULL, NULL} /* sentinel */
774 }; 814 };
775 815
776 static PyObject * 816 static PyObject *
901 displayhook() -- print an object to the screen, and save it in builtins._\n\ 941 displayhook() -- print an object to the screen, and save it in builtins._\n\
902 excepthook() -- print an exception and its traceback to sys.stderr\n\ 942 excepthook() -- print an exception and its traceback to sys.stderr\n\
903 exc_info() -- return thread-safe information about the current exception\n\ 943 exc_info() -- return thread-safe information about the current exception\n\
904 exit() -- exit the interpreter by raising SystemExit\n\ 944 exit() -- exit the interpreter by raising SystemExit\n\
905 getdlopenflags() -- returns flags to be used for dlopen() calls\n\ 945 getdlopenflags() -- returns flags to be used for dlopen() calls\n\
946 getprofile() -- get the global profiling function\n\
906 getrefcount() -- return the reference count for an object (plus one :-)\n\ 947 getrefcount() -- return the reference count for an object (plus one :-)\n\
907 getrecursionlimit() -- return the max recursion depth for the interpreter\n\ 948 getrecursionlimit() -- return the max recursion depth for the interpreter\n\
949 gettrace() -- get the global debug tracing function\n\
908 setcheckinterval() -- control how often the interpreter checks for events\n\ 950 setcheckinterval() -- control how often the interpreter checks for events\n\
909 setdlopenflags() -- set the flags to be used for dlopen() calls\n\ 951 setdlopenflags() -- set the flags to be used for dlopen() calls\n\
910 setprofile() -- set the global profiling function\n\ 952 setprofile() -- set the global profiling function\n\
911 setrecursionlimit() -- set the max recursion depth for the interpreter\n\ 953 setrecursionlimit() -- set the max recursion depth for the interpreter\n\
912 settrace() -- set the global debug tracing function\n\ 954 settrace() -- set the global debug tracing function\n\