Merge branch 'python3.3'

Conflicts:
	python3.spec
This commit is contained in:
David Malcolm 2012-08-03 18:00:41 -04:00
commit 6a38560c1b
16 changed files with 1765 additions and 1060 deletions

View File

@ -1,20 +1,14 @@
diff -up Python-3.2b2/Lib/email/test/test_email.py.remove-mimeaudio-tests Python-3.2b2/Lib/email/test/test_email.py diff -up Python-3.3.0b1/Lib/test/test_email/test_email.py.remove-mimeaudio-tests Python-3.3.0b1/Lib/test/test_email/test_email.py
--- Python-3.2b2/Lib/email/test/test_email.py.remove-mimeaudio-tests 2010-12-18 13:25:38.000000000 -0500 --- Python-3.3.0b1/Lib/test/test_email/test_email.py.remove-mimeaudio-tests 2012-06-26 16:19:47.000000000 -0400
+++ Python-3.2b2/Lib/email/test/test_email.py 2010-12-28 16:50:34.910309105 -0500 +++ Python-3.3.0b1/Lib/test/test_email/test_email.py 2012-07-20 12:04:45.316472136 -0400
@@ -977,53 +977,6 @@ Blah blah blah @@ -1285,47 +1285,6 @@ Blah blah blah
-# Test the basic MIMEAudio class -# Test the basic MIMEAudio class
-class TestMIMEAudio(unittest.TestCase): -class TestMIMEAudio(unittest.TestCase):
- def setUp(self): - def setUp(self):
- # Make sure we pick up the audiotest.au that lives in email/test/data. - with openfile('audiotest.au', 'rb') as fp:
- # In Python, there's an audiotest.au living in Lib/test but that isn't
- # included in some binary distros that don't include the test
- # package. The trailing empty string on the .join() is significant
- # since findfile() will do a dirname().
- datadir = os.path.join(os.path.dirname(landmark), 'data', '')
- with open(findfile('audiotest.au', datadir), 'rb') as fp:
- self._audiodata = fp.read() - self._audiodata = fp.read()
- self._au = MIMEAudio(self._audiodata) - self._au = MIMEAudio(self._audiodata)
- -

View File

@ -1,214 +1,808 @@
diff -up Python-3.2b2/configure.in.systemtap Python-3.2b2/configure.in diff -up Python-3.3.0b1/configure.ac.systemtap Python-3.3.0b1/configure.ac
--- Python-3.2b2/configure.in.systemtap 2010-12-13 02:59:39.000000000 -0500 --- Python-3.3.0b1/configure.ac.systemtap 2012-06-26 16:19:58.000000000 -0400
+++ Python-3.2b2/configure.in 2010-12-28 17:01:58.044059433 -0500 +++ Python-3.3.0b1/configure.ac 2012-07-20 13:05:39.221792032 -0400
@@ -2470,6 +2470,38 @@ if test "$with_valgrind" != no; then @@ -2616,6 +2616,23 @@ if test "$with_valgrind" != no; then
OPT="-DDYNAMIC_ANNOTATIONS_ENABLED=1 $OPT" OPT="-DDYNAMIC_ANNOTATIONS_ENABLED=1 $OPT"
fi fi
+# Check for dtrace support +# Check for systemtap support
+AC_MSG_CHECKING(for --with-dtrace) +# On Linux, /usr/bin/dtrace is in fact a shim to SystemTap
+AC_ARG_WITH(dtrace, +AC_MSG_CHECKING([for --with-systemtap])
+ AC_HELP_STRING(--with(out)-dtrace, disable/enable dtrace support)) +AC_ARG_WITH([systemtap],
+ + AC_HELP_STRING([--with(out)-systemtap], [disable/enable SystemTap support]),,
+if test ! -z "$with_dtrace" + with_systemtap=no)
+then +AC_MSG_RESULT([$with_systemtap])
+ if dtrace -G -o /dev/null -s $srcdir/Include/pydtrace.d 2>/dev/null +if test "$with_systemtap" != no; then
+ then + AC_DEFINE(WITH_SYSTEMTAP, 1,
+ AC_DEFINE(WITH_DTRACE, 1, + [Define if you want to compile in SystemTap support])
+ [Define if you want to compile in Dtrace support]) + SYSTEMTAPOBJS="Python/pysystemtap.o"
+ with_dtrace="Sun" + SYSTEMTAPDEPS="\$(srcdir)/Python/pysystemtap.h"
+ DTRACEOBJS="Python/dtrace.o"
+ DTRADEHDRS=""
+ elif dtrace -h -o /dev/null -s $srcdir/Include/pydtrace.d
+ then
+ AC_DEFINE(WITH_DTRACE, 1,
+ [Define if you want to compile in Dtrace support])
+ with_dtrace="Apple"
+ DTRACEOBJS=""
+ DTRADEHDRS="pydtrace.h"
+ else
+ with_dtrace="no"
+ fi
+else
+ with_dtrace="no"
+fi +fi
+ +
+AC_MSG_RESULT($with_dtrace) +AC_SUBST(SYSTEMTAPOBJS)
+AC_SUBST(DTRACEOBJS) +AC_SUBST(SYSTEMTAPDEPS)
+AC_SUBST(DTRACEHDRS)
+ +
# -I${DLINCLDIR} is added to the compile rule for importdl.o # -I${DLINCLDIR} is added to the compile rule for importdl.o
AC_SUBST(DLINCLDIR) AC_SUBST(DLINCLDIR)
DLINCLDIR=. DLINCLDIR=.
diff -up Python-3.2b2/Include/pydtrace.d.systemtap Python-3.2b2/Include/pydtrace.d diff -up Python-3.3.0b1/configure.systemtap Python-3.3.0b1/configure
--- Python-3.2b2/Include/pydtrace.d.systemtap 2010-12-28 16:58:41.762936379 -0500 --- Python-3.3.0b1/configure.systemtap 2012-06-26 16:19:58.000000000 -0400
+++ Python-3.2b2/Include/pydtrace.d 2010-12-28 16:58:41.762936379 -0500 +++ Python-3.3.0b1/configure 2012-07-20 13:05:39.220792044 -0400
@@ -0,0 +1,10 @@ @@ -638,6 +638,8 @@ TRUE
+provider python { MACHDEP_OBJS
+ probe function__entry(const char *, const char *, int); DYNLOADFILE
+ probe function__return(const char *, const char *, int); DLINCLDIR
+}; +SYSTEMTAPDEPS
+SYSTEMTAPOBJS
THREADOBJ
LDLAST
USE_THREAD_MODULE
@@ -793,6 +795,7 @@ with_doc_strings
with_tsc
with_pymalloc
with_valgrind
+with_systemtap
with_fpectl
with_libm
with_libc
@@ -1468,6 +1471,7 @@ Optional Packages:
--with(out)-tsc enable/disable timestamp counter profile
--with(out)-pymalloc disable/enable specialized mallocs
--with-valgrind Enable Valgrind support
+ --with(out)-systemtap disable/enable SystemTap support
--with-fpectl enable SIGFPE catching
--with-libm=STRING math library
--with-libc=STRING C library
@@ -9639,6 +9643,31 @@ fi
OPT="-DDYNAMIC_ANNOTATIONS_ENABLED=1 $OPT"
fi
+# Check for systemtap support
+# On Linux, /usr/bin/dtrace is in fact a shim to SystemTap
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for --with-systemtap" >&5
+$as_echo_n "checking for --with-systemtap... " >&6; }
+ +
+#pragma D attributes Evolving/Evolving/Common provider python provider +# Check whether --with-systemtap was given.
+#pragma D attributes Private/Private/Common provider python module +if test "${with_systemtap+set}" = set; then :
+#pragma D attributes Private/Private/Common provider python function + withval=$with_systemtap;
+#pragma D attributes Evolving/Evolving/Common provider python name +else
+#pragma D attributes Evolving/Evolving/Common provider python args + with_systemtap=no
diff -up Python-3.2b2/Makefile.pre.in.systemtap Python-3.2b2/Makefile.pre.in +fi
--- Python-3.2b2/Makefile.pre.in.systemtap 2010-12-28 16:58:41.000000000 -0500 +
+++ Python-3.2b2/Makefile.pre.in 2010-12-28 17:00:58.607310089 -0500 +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $with_systemtap" >&5
@@ -328,6 +328,7 @@ PYTHON_OBJS= \ +$as_echo "$with_systemtap" >&6; }
+if test "$with_systemtap" != no; then
+
+$as_echo "#define WITH_SYSTEMTAP 1" >>confdefs.h
+
+ SYSTEMTAPOBJS="Python/pysystemtap.o"
+ SYSTEMTAPDEPS="\$(srcdir)/Python/pysystemtap.h"
+fi
+
+
+
+
# -I${DLINCLDIR} is added to the compile rule for importdl.o
DLINCLDIR=.
diff -up Python-3.3.0b1/Doc/howto/index.rst.systemtap Python-3.3.0b1/Doc/howto/index.rst
--- Python-3.3.0b1/Doc/howto/index.rst.systemtap 2012-06-26 16:19:37.000000000 -0400
+++ Python-3.3.0b1/Doc/howto/index.rst 2012-07-20 13:05:39.215792107 -0400
@@ -29,4 +29,5 @@ Currently, the HOWTOs are:
webservers.rst
argparse.rst
ipaddress.rst
+ instrumentation.rst
diff -up Python-3.3.0b1/Doc/howto/instrumentation.rst.systemtap Python-3.3.0b1/Doc/howto/instrumentation.rst
--- Python-3.3.0b1/Doc/howto/instrumentation.rst.systemtap 2012-07-20 13:05:39.215792107 -0400
+++ Python-3.3.0b1/Doc/howto/instrumentation.rst 2012-07-20 13:05:39.215792107 -0400
@@ -0,0 +1,295 @@
+.. _instrumentation:
+
+====================================
+Instrumenting CPython with SystemTap
+====================================
+
+:author: David Malcolm <dmalcolm@redhat.com>
+
+DTrace and SystemTap are monitoring tools, each providing a way to inspect
+what the processes on a computer system are doing. They both use
+domain-specific languages allowing a user to write scripts which:
+
+ - filter which processes are to be observed
+ - gather data from the processes of interest
+ - generate reports on the data
+
+As of Python 3.3, CPython can be built with embedded "markers" that can be
+observed by a SystemTap script, making it easier to monitor what the CPython
+processes on a system are doing.
+
+.. Potentially this document could be expanded to also cover DTrace markers.
+ However, I'm not a DTrace expert.
+
+.. I'm using ".. code-block:: c" for SystemTap scripts, as "c" is syntactically
+ the closest match that Sphinx supports
+
+
+Enabling the static markers
+---------------------------
+
+In order to build CPython with the embedded markers for SystemTap, the
+SystemTap development tools must be installed.
+
+On a Fedora or Red Hat Enterprise Linux machine, this can be done via::
+
+ yum install systemtap-sdt-devel
+
+CPython must then be configured `--with-systemtap`::
+
+ checking for --with-systemtap... yes
+
+You can verify if the SystemTap static markers are present in the built
+binary by seeing if it contains a ".note.stapsdt" section.
+
+.. code-block:: bash
+
+ $ eu-readelf -S ./python | grep .note.stapsdt
+ [29] .note.stapsdt NOTE 0000000000000000 00308d78 000000b8 0 0 0 4
+
+If you've built python as a shared library (with --enable-shared), you need
+to look instead within the shared library. For example:
+
+.. code-block:: bash
+
+ $ eu-readelf -S libpython3.3dm.so.1.0 | grep .note.stapsdt
+ [28] .note.stapsdt NOTE 0000000000000000 00365b68 000000b8 0 0 0 4
+
+Earlier versions of SystemTap stored the markers in a ".probes" section.
+
+For the curious, you can see the metadata for the static markers using this
+invocation.
+
+.. code-block:: bash
+
+ $ eu-readelf -x .note.stapsdt ./python
+
+ Hex dump of section [29] '.note.stapsdt', 184 bytes at offset 0x308d78:
+ 0x00000000 08000000 45000000 03000000 73746170 ....E.......stap
+ 0x00000010 73647400 d4664b00 00000000 4fc36600 sdt..fK.....O.f.
+ 0x00000020 00000000 488d9000 00000000 70797468 ....H.......pyth
+ 0x00000030 6f6e0066 756e6374 696f6e5f 5f656e74 on.function__ent
+ 0x00000040 72790038 40257261 78203840 25726478 ry.8@%rax 8@%rdx
+ 0x00000050 202d3440 25656378 00000000 08000000 -4@%ecx........
+ 0x00000060 46000000 03000000 73746170 73647400 F.......stapsdt.
+ 0x00000070 0d674b00 00000000 4fc36600 00000000 .gK.....O.f.....
+ 0x00000080 4a8d9000 00000000 70797468 6f6e0066 J.......python.f
+ 0x00000090 756e6374 696f6e5f 5f726574 75726e00 unction__return.
+ 0x000000a0 38402572 61782038 40257264 78202d34 8@%rax 8@%rdx -4
+ 0x000000b0 40256563 78000000 @%ecx...
+
+and a sufficiently modern eu-readelf can print the metadata:
+
+.. code-block:: bash
+
+ $ eu-readelf -n ./python
+
+ Note section [ 1] '.note.gnu.build-id' of 36 bytes at offset 0x190:
+ Owner Data size Type
+ GNU 20 GNU_BUILD_ID
+ Build ID: a28f8db1b224530b0d38ad7b82a249cf7c3f18d6
+
+ Note section [27] '.note.stapsdt' of 184 bytes at offset 0x1ae884:
+ Owner Data size Type
+ stapsdt 70 Version: 3
+ PC: 0xe0d3a, Base: 0x14b150, Semaphore: 0x3ae882
+ Provider: python, Name: function__return, Args: '8@%rbx 8@%r13 -4@%eax'
+ stapsdt 69 Version: 3
+ PC: 0xe0f37, Base: 0x14b150, Semaphore: 0x3ae880
+ Provider: python, Name: function__entry, Args: '8@%rbx 8@%r13 -4@%eax'
+
+The above metadata contains information for SystemTap describing how it can
+patch strategically-placed machine code instructions to enable the tracing
+hooks used by a SystemTap script.
+
+
+Static markers
+--------------
+
+The low-level way to use the SystemTap integration is to use the static
+markers directly. This requires you to explicitly state the binary file
+containing them.
+
+For example, this script can be used to show the call/return hierarchy of a
+Python script:
+
+.. code-block:: c
+
+ probe process('python').mark("function__entry") {
+ filename = user_string($arg1);
+ funcname = user_string($arg2);
+ lineno = $arg3;
+
+ printf("%s => %s in %s:%d\\n",
+ thread_indent(1), funcname, filename, lineno);
+ }
+
+ probe process('python').mark("function__return") {
+ filename = user_string($arg1);
+ funcname = user_string($arg2);
+ lineno = $arg3;
+
+ printf("%s <= %s in %s:%d\\n",
+ thread_indent(-1), funcname, filename, lineno);
+ }
+
+It can be invoked like this:
+
+.. code-block:: bash
+
+ $ stap \
+ show-call-hierarchy.stp \
+ -c ./python test.py
+
+The output looks like this::
+
+ 11408 python(8274): => __contains__ in Lib/_abcoll.py:362
+ 11414 python(8274): => __getitem__ in Lib/os.py:425
+ 11418 python(8274): => encode in Lib/os.py:490
+ 11424 python(8274): <= encode in Lib/os.py:493
+ 11428 python(8274): <= __getitem__ in Lib/os.py:426
+ 11433 python(8274): <= __contains__ in Lib/_abcoll.py:366
+
+where the columns are:
+
+ - time in microseconds since start of script
+
+ - name of executable
+
+ - PID of process
+
+and the remainder indicates the call/return hierarchy as the script executes.
+
+For a `--enable-shared` build of CPython, the markers are contained within the
+libpython shared library, and the probe's dotted path needs to reflect this. For
+example, this line from the above example::
+
+ probe process('python').mark("function__entry") {
+
+should instead read::
+
+ probe process('python').library("libpython3.3dm.so.1.0").mark("function__entry") {
+
+(assuming a debug build of CPython 3.3)
+
+.. I'm reusing the "c:function" type for markers
+
+.. c:function:: function__entry(str filename, str funcname, int lineno)
+
+ This marker indicates that execution of a Python function has begun. It is
+ only triggered for pure-python (bytecode) functions.
+
+ The filename, function name, and line number are provided back to the
+ tracing script as positional arguments, which must be accessed using
+ `$arg1`, `$arg2`:
+
+ * `$arg1` : `(const char *)` filename, accessible using `user_string($arg1)`
+
+ * `$arg2` : `(const char *)` function name, accessible using
+ `user_string($arg2)`
+
+ * `$arg3` : `int` line number
+
+ * `$arg4` : `(PyFrameObject *)`, the frame being executed
+
+.. c:function:: function__return(str filename, str funcname, int lineno)
+
+ This marker is the converse of `function__entry`, and indicates that
+ execution of a Python function has ended (either via ``return``, or via an
+ exception). It is only triggered for pure-python (bytecode) functions.
+
+ The arguments are the same as for `function__entry`
+
+
+Tapsets
+-------
+
+The higher-level way to use the SystemTap integration is to use a "tapset":
+SystemTap's equivalent of a library, which hides some of the lower-level
+details of the static markers.
+
+Here is a tapset file, based on a non-shared build of CPython:
+
+.. code-block:: c
+
+ /*
+ Provide a higher-level wrapping around the function__entry and
+ function__return markers:
+ */
+ probe python.function.entry = process("python").mark("function__entry")
+ {
+ filename = user_string($arg1);
+ funcname = user_string($arg2);
+ lineno = $arg3;
+ frameptr = $arg4
+ }
+ probe python.function.return = process("python").mark("function__return")
+ {
+ filename = user_string($arg1);
+ funcname = user_string($arg2);
+ lineno = $arg3;
+ frameptr = $arg4
+ }
+
+If this file is installed in SystemTap's tapset directory (e.g.
+`/usr/share/systemtap/tapset`), then these additional probepoints become
+available:
+
+.. c:function:: python.function.entry(str filename, str funcname, int lineno, frameptr)
+
+ This probe point indicates that execution of a Python function has begun.
+ It is only triggered for pure-python (bytecode) functions.
+
+.. c:function:: python.function.return(str filename, str funcname, int lineno, frameptr)
+
+ This probe point is the converse of `python.function.return`, and indicates
+ that execution of a Python function has ended (either via ``return``, or
+ via an exception). It is only triggered for pure-python (bytecode) functions.
+
+
+Examples
+--------
+This SystemTap script uses the tapset above to more cleanly implement the
+example given above of tracing the Python function-call hierarchy, without
+needing to directly name the static markers:
+
+.. code-block:: c
+
+ probe python.function.entry
+ {
+ printf("%s => %s in %s:%d\n",
+ thread_indent(1), funcname, filename, lineno);
+ }
+
+ probe python.function.return
+ {
+ printf("%s <= %s in %s:%d\n",
+ thread_indent(-1), funcname, filename, lineno);
+ }
+
+
+The following script uses the tapset above to provide a top-like view of all
+running CPython code, showing the top 20 most frequently-entered bytecode
+frames, each second, across the whole system:
+
+.. code-block:: c
+
+ global fn_calls;
+
+ probe python.function.entry
+ {
+ fn_calls[pid(), filename, funcname, lineno] += 1;
+ }
+
+ probe timer.ms(1000) {
+ printf("\033[2J\033[1;1H") /* clear screen */
+ printf("%6s %80s %6s %30s %6s\n",
+ "PID", "FILENAME", "LINE", "FUNCTION", "CALLS")
+ foreach ([pid, filename, funcname, lineno] in fn_calls- limit 20) {
+ printf("%6d %80s %6d %30s %6d\n",
+ pid, filename, lineno, funcname,
+ fn_calls[pid, filename, funcname, lineno]);
+ }
+ delete fn_calls;
+ }
+
diff -up Python-3.3.0b1/Lib/test/test_systemtap.py.systemtap Python-3.3.0b1/Lib/test/test_systemtap.py
--- Python-3.3.0b1/Lib/test/test_systemtap.py.systemtap 2012-07-20 13:05:39.215792107 -0400
+++ Python-3.3.0b1/Lib/test/test_systemtap.py 2012-07-20 13:05:39.215792107 -0400
@@ -0,0 +1,205 @@
+# Verify that systemtap static probes work
+#
+import subprocess
+import sys
+import sysconfig
+import os
+import unittest
+
+from test.support import run_unittest, TESTFN, unlink
+
+if '--with-systemtap' not in sysconfig.get_config_var('CONFIG_ARGS'):
+ raise unittest.SkipTest("Python was not configured --with-systemtap")
+
+try:
+ _, stap_version = subprocess.Popen(["stap", "-V"],
+ stdout=subprocess.PIPE,
+ stderr=subprocess.PIPE,
+ ).communicate()
+except OSError:
+ # This is what "no stap" looks like. There may, however, be other
+ # errors that manifest this way too.
+ raise unittest.SkipTest("Couldn't find stap on the path")
+
+def invoke_systemtap_script(script, cmd):
+ # Start a child process, probing with the given systemtap script
+ # (passed as stdin to the "stap" tool)
+ # The script should be a bytes instance
+ # Return (stdout, stderr) pair
+
+ p = subprocess.Popen(["stap", "-", '-vv', '-c', cmd],
+ stdin=subprocess.PIPE,
+ stdout=subprocess.PIPE,
+ stderr=subprocess.PIPE)
+ out, err = p.communicate(input=script)
+ return out, err
+
+# Verify that stap can run a simple "hello world"-style script
+# This can fail for various reasons:
+# - missing kernel headers
+# - permissions (a non-root user needs to be in the "stapdev" group)
+TRIVIAL_STAP_SCRIPT = b'probe begin { println("hello world") exit () }'
+
+out, err = invoke_systemtap_script(TRIVIAL_STAP_SCRIPT, 'true')
+if out != b'hello world\n':
+ raise unittest.SkipTest("Test systemtap script did not run; stderr was: %s" % err)
+
+# We don't expect stderr to be empty, since we're invoking stap with "-vv": stap
+# will (we hope) generate debugging output on stderr.
+
+def invoke_python_under_systemtap(script, pythoncode=None, pythonfile=None):
+ # Start a child python process, probing with the given systemtap script
+ # (passed as stdin to the "stap" tool)
+ # The script should be a bytes instance
+ # Return (stdout, stderr) pair
+
+ if pythonfile:
+ pythoncmd = '%s %s' % (sys.executable, pythonfile)
+ else:
+ pythoncmd = '%s -c %r' % (sys.executable, pythoncode)
+
+ # The process tree of a stap invocation of a command goes through
+ # something like this:
+ # stap ->fork/exec(staprun; exec stapio ->f/e(-c cmd); exec staprun -r)
+ # and this trip through setuid leads to LD_LIBRARY_PATH being dropped,
+ # which would lead to an --enable-shared build of python failing to be
+ # find its libpython, with an error like:
+ # error while loading shared libraries: libpython3.3dm.so.1.0: cannot
+ # open shared object file: No such file or directory
+ # Hence we need to jump through some hoops to expose LD_LIBRARY_PATH to
+ # the invoked python process:
+ LD_LIBRARY_PATH = os.environ.get('LD_LIBRARY_PATH', '')
+ if LD_LIBRARY_PATH:
+ pythoncmd = 'env LD_LIBRARY_PATH=%s ' % LD_LIBRARY_PATH + pythoncmd
+
+ return invoke_systemtap_script(script, pythoncmd)
+
+# When using the static markers, we need to supply the prefix of a systemtap
+# dotted probe point that containing the marker.
+# See http://sourceware.org/systemtap/langref/Probe_points.html
+#
+# We need to determine if this is a shared-library build
+#
+# Note that sysconfig can get this wrong; see:
+# http://bugs.python.org/issue14774
+#
+if '--enable-shared' in sysconfig.get_config_var('CONFIG_ARGS'):
+ # For a shared-library build, the markers are in library(INSTSONAME):
+ INSTSONAME = sysconfig.get_config_var('INSTSONAME')
+ probe_prefix = 'process("%s").library("%s")' % (sys.executable, INSTSONAME)
+else:
+ # For a non-shared-library build, we can simply use sys.executable:
+ probe_prefix = 'process("%s")' % sys.executable
+
+# The following script ought to generate lots of lines showing recursive
+# function entry and return, of the form:
+# 11408 python(8274): => __contains__ in Lib/_abcoll.py:362
+# 11414 python(8274): => __getitem__ in Lib/os.py:425
+# 11418 python(8274): => encode in Lib/os.py:490
+# 11424 python(8274): <= encode in Lib/os.py:493
+# 11428 python(8274): <= __getitem__ in Lib/os.py:426
+# 11433 python(8274): <= __contains__ in Lib/_abcoll.py:366
+# where the column are:
+# - time in microseconds since start of script
+# - name of executable
+# - PID of process
+# and the remainder indicates the call/return hierarchy
+
+hierarchy_script = ('''
+probe %s.mark("function__entry") {
+ filename = user_string($arg1);
+ funcname = user_string($arg2);
+ lineno = $arg3;
+
+ printf("%%s => %%s in %%s:%%d\\n", thread_indent(1), funcname, filename, lineno);
+}
+
+probe %s.mark("function__return") {
+ filename = user_string($arg1);
+ funcname = user_string($arg2);
+ lineno = $arg3;
+
+ printf("%%s <= %%s in %%s:%%d\\n", thread_indent(-1), funcname, filename, lineno);
+}
+''' % (probe_prefix, probe_prefix)).encode('utf-8')
+
+
+class ErrorDumper:
+ # A context manager that dumps extra information if an exception is raised,
+ # to help track down why the problem occurred
+ def __init__(self, out, err):
+ self.out = out
+ self.err = err
+
+ def __enter__(self):
+ pass
+
+ def __exit__(self, type_, value, traceback):
+ if type_:
+ # an exception is being raised:
+ print('stdout: %s' % out.decode())
+ print('stderr: %s' % err.decode())
+
+class SystemtapTests(unittest.TestCase):
+
+ def test_invoking_python(self):
+ # Ensure that we can invoke python under stap, with a trivial stap
+ # script:
+ out, err = invoke_python_under_systemtap(
+ b'probe begin { println("hello from stap") exit () }',
+ pythoncode="print('hello from python')")
+ with ErrorDumper(out, err):
+ self.assertIn(b'hello from stap', out)
+ self.assertIn(b'hello from python', out)
+
+ def test_function_entry(self):
+ # Ensure that the function_entry static marker works
+ out, err = invoke_python_under_systemtap(hierarchy_script)
+ # stdout ought to contain various lines showing recursive function
+ # entry and return (see above)
+
+ # Uncomment this for debugging purposes:
+ # print(out.decode('utf-8'))
+
+ # Executing the cmdline-supplied "pass":
+ # 0 python(8274): => <module> in <string>:1
+ # 5 python(8274): <= <module> in <string>:1
+ with ErrorDumper(out, err):
+ self.assertIn(b'=> <module> in <string>:1', out,
+ msg="stdout: %s\nstderr: %s\n" % (out, err))
+
+ def test_encoding(self):
+ # Ensure that scripts and function names containing non-Latin 1 code
+ # points are handled:
+ pythonfile = TESTFN + '_☠.py'
+ try:
+ unlink(pythonfile)
+ f = open(pythonfile, "wb")
+ f.write("""
+# Sample script with non-ASCII filename, for use by test_systemtap.py
+# Implicitly UTF-8
+
+def 文字化け():
+ '''Function with non-ASCII identifier; I believe this reads "mojibake"'''
+ print("hello world!")
+
+文字化け()
+""".encode('utf-8'))
+ f.close()
+
+ out, err = invoke_python_under_systemtap(hierarchy_script,
+ pythonfile=pythonfile)
+ out_utf8 = out.decode('utf-8')
+ with ErrorDumper(out, err):
+ self.assertIn('=> <module> in %s:5' % pythonfile, out_utf8)
+ self.assertIn(' => 文字化け in %s:5' % pythonfile, out_utf8)
+ self.assertIn(' <= 文字化け in %s:7' % pythonfile, out_utf8)
+ self.assertIn('<= <module> in %s:9' % pythonfile, out_utf8)
+ finally:
+ unlink(pythonfile)
+
+def test_main():
+ run_unittest(SystemtapTests)
+
+if __name__ == "__main__":
+ test_main()
diff -up Python-3.3.0b1/Makefile.pre.in.systemtap Python-3.3.0b1/Makefile.pre.in
--- Python-3.3.0b1/Makefile.pre.in.systemtap 2012-06-26 16:19:51.000000000 -0400
+++ Python-3.3.0b1/Makefile.pre.in 2012-07-20 13:05:39.216792095 -0400
@@ -358,6 +358,7 @@ PYTHON_OBJS= \
Python/formatter_unicode.o \ Python/formatter_unicode.o \
Python/fileutils.o \ Python/fileutils.o \
Python/$(DYNLOADFILE) \ Python/$(DYNLOADFILE) \
+ @DTRACEOBJS@ \ + @SYSTEMTAPOBJS@ \
$(LIBOBJS) \ $(LIBOBJS) \
$(MACHDEP_OBJS) \ $(MACHDEP_OBJS) \
$(THREADOBJ) $(THREADOBJ)
@@ -632,6 +633,18 @@ Objects/typeobject.o: $(srcdir)/Objects/ @@ -708,7 +709,8 @@ Objects/setobject.o: $(srcdir)/Objects/s
$(OPCODETARGETS_H): $(OPCODETARGETGEN_FILES)
$(OPCODETARGETGEN) $(OPCODETARGETS_H)
-Python/ceval.o: $(OPCODETARGETS_H) $(srcdir)/Python/ceval_gil.h
+Python/ceval.o: $(OPCODETARGETS_H) $(srcdir)/Python/ceval_gil.h \
+ $(srcdir)/Python/ceval_systemtap.h @SYSTEMTAPDEPS@
Python/formatter_unicode.o: $(srcdir)/Python/formatter_unicode.c \
$(BYTESTR_DEPS)
@@ -719,6 +721,13 @@ Objects/typeobject.o: $(srcdir)/Objects/
$(srcdir)/Objects/typeslots.inc: $(srcdir)/Include/typeslots.h $(srcdir)/Objects/typeslots.py $(srcdir)/Objects/typeslots.inc: $(srcdir)/Include/typeslots.h $(srcdir)/Objects/typeslots.py
$(PYTHON) $(srcdir)/Objects/typeslots.py < $(srcdir)/Include/typeslots.h > $(srcdir)/Objects/typeslots.inc $(PYTHON) $(srcdir)/Objects/typeslots.py < $(srcdir)/Include/typeslots.h > $(srcdir)/Objects/typeslots.inc
+# Only needed with --with-dtrace +# Only needed with --with-systemtap; not a public header:
+buildinclude: +$(srcdir)/Python/pysystemtap.h: $(srcdir)/Python/pysystemtap.d
+ mkdir -p Include + dtrace -o $@ $(DFLAGS) -C -h -s $(srcdir)/Python/pysystemtap.d
+ +
+Include/pydtrace.h: buildinclude $(srcdir)/Include/pydtrace.d +Python/pysystemtap.o: $(srcdir)/Python/pysystemtap.d Python/ceval.o
+ dtrace -o $@ $(DFLAGS) -C -h -s $(srcdir)/Include/pydtrace.d + dtrace -o $@ $(DFLAGS) -C -G -s $(srcdir)/Python/pysystemtap.d Python/ceval.o
+
+Python/ceval.o: Include/pydtrace.h
+
+Python/dtrace.o: buildinclude $(srcdir)/Include/pydtrace.d Python/ceval.o
+ dtrace -o $@ $(DFLAGS) -C -G -s $(srcdir)/Include/pydtrace.d Python/ceval.o
+ +
############################################################################ ############################################################################
# Header files # Header files
@@ -1282,7 +1295,7 @@ Python/thread.o: @THREADHEADERS@ @@ -1335,6 +1344,7 @@ clean: pycremoval
.PHONY: frameworkinstall frameworkinstallframework frameworkinstallstructure -rm -f Lib/lib2to3/*Grammar*.pickle
.PHONY: frameworkinstallmaclib frameworkinstallapps frameworkinstallunixtools -rm -f $(SYSCONFIGDATA)
.PHONY: frameworkaltinstallunixtools recheck autoconf clean clobber distclean -rm -f Modules/_testembed Modules/_freeze_importlib
-.PHONY: smelly funny patchcheck + -rm -f $(srcdir)/Python/pysystemtap.h
+.PHONY: smelly funny patchcheck buildinclude
.PHONY: gdbhooks
# IF YOU PUT ANYTHING HERE IT WILL GO AWAY profile-removal:
diff -up Python-3.2b2/pyconfig.h.in.systemtap Python-3.2b2/pyconfig.h.in find . -name '*.gc??' -exec rm -f {} ';'
--- Python-3.2b2/pyconfig.h.in.systemtap 2010-11-20 05:29:12.000000000 -0500 diff -up Python-3.3.0b1/Misc/NEWS.systemtap Python-3.3.0b1/Misc/NEWS
+++ Python-3.2b2/pyconfig.h.in 2010-12-28 16:58:41.765937360 -0500 --- Python-3.3.0b1/Misc/NEWS.systemtap 2012-06-26 16:19:51.000000000 -0400
@@ -1092,6 +1092,9 @@ +++ Python-3.3.0b1/Misc/NEWS 2012-07-20 13:05:39.217792083 -0400
/* Define if you want documentation strings in extension modules */ @@ -55,6 +55,11 @@ Core and Builtins
#undef WITH_DOC_STRINGS
+/* Define if you want to compile in Dtrace support */ - Issue #15038: Optimize python Locks on Windows.
+#undef WITH_DTRACE
+- Issue #14776: Added a new --with-systemtap configure-time option, which adds
+ static markers for SystemTap so that SystemTap scripts can observe bytecode
+ frames being entered and exited and so generate reports on what Python code
+ is being exectuted.
+ +
/* Define if you want to use the new-style (Openstep, Rhapsody, MacOS) dynamic Library
linker (dyld) instead of the old-style (NextStep) dynamic linker (rld). -------
Dyld is necessary to support frameworks. */
diff -up Python-3.2b2/Python/ceval.c.systemtap Python-3.2b2/Python/ceval.c diff -up Python-3.3.0b1/pyconfig.h.in.systemtap Python-3.3.0b1/pyconfig.h.in
--- Python-3.2b2/Python/ceval.c.systemtap 2010-12-03 15:14:31.000000000 -0500 --- Python-3.3.0b1/pyconfig.h.in.systemtap 2012-06-26 16:19:58.000000000 -0400
+++ Python-3.2b2/Python/ceval.c 2010-12-28 16:58:41.768935588 -0500 +++ Python-3.3.0b1/pyconfig.h.in 2012-07-20 13:05:39.222792020 -0400
@@ -18,6 +18,10 @@ @@ -1306,6 +1306,9 @@
/* Define if you want to compile in Python-specific mallocs */
#undef WITH_PYMALLOC
+/* Define if you want to compile in SystemTap support */
+#undef WITH_SYSTEMTAP
+
/* Define if you want to compile in rudimentary thread support */
#undef WITH_THREAD
diff -up Python-3.3.0b1/Python/ceval.c.systemtap Python-3.3.0b1/Python/ceval.c
--- Python-3.3.0b1/Python/ceval.c.systemtap 2012-06-26 16:19:56.000000000 -0400
+++ Python-3.3.0b1/Python/ceval.c 2012-07-20 13:05:39.218792070 -0400
@@ -18,6 +18,8 @@
#include <ctype.h> #include <ctype.h>
+#ifdef WITH_DTRACE +#include "ceval_systemtap.h"
+#include "pydtrace.h"
+#endif
+ +
#ifndef WITH_TSC #ifndef WITH_TSC
#define READ_TIMESTAMP(var) #define READ_TIMESTAMP(var)
@@ -766,6 +770,70 @@ PyEval_EvalCode(PyObject *co, PyObject * @@ -1160,6 +1162,10 @@ PyEval_EvalFrameEx(PyFrameObject *f, int
}
+#ifdef WITH_DTRACE
+struct frame_marker_info
+{
+ char *filename;
+ char *name;
+ int lineno;
+
+ PyObject *utf8_filename;
+ PyObject *utf8_name;
+};
+
+static void
+get_frame_marker_info(PyFrameObject *f, struct frame_marker_info *fmi)
+{
+ fmi->utf8_filename = PyUnicode_AsUTF8String(f->f_code->co_filename);
+ if (fmi->utf8_filename) {
+ fmi->filename = PyBytes_AsString(fmi->utf8_filename);
+ } else {
+ fmi->filename = NULL;
+ /* FIXME: clear the exception? */
+ }
+
+ fmi->utf8_name = PyUnicode_AsUTF8String(f->f_code->co_name);
+ if (fmi->utf8_name) {
+ fmi->name = PyBytes_AsString(fmi->utf8_name);
+ } else {
+ fmi->name = NULL;
+ /* FIXME: clear the exception? */
+ }
+
+ fmi->lineno = PyCode_Addr2Line(f->f_code, f->f_lasti);
+}
+
+static void
+release_frame_marker_info(struct frame_marker_info *fmi)
+{
+ Py_XDECREF(fmi->utf8_filename);
+ Py_XDECREF(fmi->utf8_name);
+}
+
+static void
+dtrace_entry(PyFrameObject *f)
+{
+ struct frame_marker_info fmi;
+ get_frame_marker_info(f, &fmi);
+ PYTHON_FUNCTION_ENTRY(fmi.filename, fmi.name, fmi.lineno);
+ release_frame_marker_info(&fmi);
+}
+
+static void
+dtrace_return(PyFrameObject *f)
+{
+ struct frame_marker_info fmi;
+ get_frame_marker_info(f, &fmi);
+ PYTHON_FUNCTION_RETURN(fmi.filename, fmi.name, fmi.lineno);
+ release_frame_marker_info(&fmi);
+}
+#else
+#define PYTHON_FUNCTION_ENTRY_ENABLED() 0
+#define PYTHON_FUNCTION_RETURN_ENABLED() 0
+#define dtrace_entry(f)
+#define dtrace_return(f)
+#endif
+
/* Interpreter main loop */
PyObject *
@@ -1183,6 +1251,10 @@ PyEval_EvalFrameEx(PyFrameObject *f, int
} }
} }
+ if (PYTHON_FUNCTION_ENTRY_ENABLED()) { + if (PYTHON_FUNCTION_ENTRY_ENABLED()) {
+ dtrace_entry(f); + systemtap_function_entry(f);
+ } + }
+ +
co = f->f_code; co = f->f_code;
names = co->co_names; names = co->co_names;
consts = co->co_consts; consts = co->co_consts;
@@ -3048,6 +3120,9 @@ fast_yield: @@ -3077,6 +3083,11 @@ fast_yield:
/* pop frame */ /* pop frame */
exit_eval_frame: exit_eval_frame:
+
+ if (PYTHON_FUNCTION_RETURN_ENABLED()) { + if (PYTHON_FUNCTION_RETURN_ENABLED()) {
+ dtrace_return(f); + systemtap_function_return(f);
+ } + }
+
Py_LeaveRecursiveCall(); Py_LeaveRecursiveCall();
tstate->frame = f->f_back; tstate->frame = f->f_back;
diff -up Python-3.3.0b1/Python/ceval_systemtap.h.systemtap Python-3.3.0b1/Python/ceval_systemtap.h
--- Python-3.3.0b1/Python/ceval_systemtap.h.systemtap 2012-07-20 13:05:39.218792070 -0400
+++ Python-3.3.0b1/Python/ceval_systemtap.h 2012-07-20 13:05:39.218792070 -0400
@@ -0,0 +1,86 @@
+/*
+ Support for SystemTap static markers
+*/
+
+#ifdef WITH_SYSTEMTAP
+
+#include "pysystemtap.h"
+
+/*
+ A struct to hold all of the information gathered when one of the traceable
+ markers is triggered
+*/
+struct frame_marker_info
+{
+ PyObject *filename_obj;
+ PyObject *funcname_obj;
+ const char *filename;
+ const char *funcname;
+ int lineno;
+};
+
+static void
+get_frame_marker_info(PyFrameObject *f, struct frame_marker_info *fmi)
+{
+ PyObject *ptype;
+ PyObject *pvalue;
+ PyObject *ptraceback;
+
+ PyErr_Fetch(&ptype, &pvalue, &ptraceback);
+
+ fmi->filename_obj = PyUnicode_EncodeFSDefault(f->f_code->co_filename);
+ if (fmi->filename_obj) {
+ fmi->filename = PyBytes_AsString(fmi->filename_obj);
+ } else {
+ fmi->filename = NULL;
+ }
+
+ fmi->funcname_obj = PyUnicode_AsUTF8String(f->f_code->co_name);
+ if (fmi->funcname_obj) {
+ fmi->funcname = PyBytes_AsString(fmi->funcname_obj);
+ } else {
+ fmi->funcname = NULL;
+ }
+
+ fmi->lineno = PyCode_Addr2Line(f->f_code, f->f_lasti);
+
+ PyErr_Restore(ptype, pvalue, ptraceback);
+
+}
+
+static void
+release_frame_marker_info(struct frame_marker_info *fmi)
+{
+ Py_XDECREF(fmi->filename_obj);
+ Py_XDECREF(fmi->funcname_obj);
+}
+
+static void
+systemtap_function_entry(PyFrameObject *f)
+{
+ struct frame_marker_info fmi;
+ get_frame_marker_info(f, &fmi);
+ PYTHON_FUNCTION_ENTRY(fmi.filename, fmi.funcname, fmi.lineno, f);
+ release_frame_marker_info(&fmi);
+}
+
+static void
+systemtap_function_return(PyFrameObject *f)
+{
+ struct frame_marker_info fmi;
+ get_frame_marker_info(f, &fmi);
+ PYTHON_FUNCTION_RETURN(fmi.filename, fmi.funcname, fmi.lineno, f);
+ release_frame_marker_info(&fmi);
+}
+
+#else /* #ifdef WITH_SYSTEMTAP */
+
+/*
+ When configured --without-systemtap, everything compiles away to nothing:
+*/
+#define PYTHON_FUNCTION_ENTRY_ENABLED() 0
+#define PYTHON_FUNCTION_RETURN_ENABLED() 0
+#define systemtap_function_entry(f)
+#define systemtap_function_return(f)
+
+#endif
diff -up Python-3.3.0b1/Python/pysystemtap.d.systemtap Python-3.3.0b1/Python/pysystemtap.d
--- Python-3.3.0b1/Python/pysystemtap.d.systemtap 2012-07-20 13:05:39.218792070 -0400
+++ Python-3.3.0b1/Python/pysystemtap.d 2012-07-20 13:05:39.218792070 -0400
@@ -0,0 +1,4 @@
+provider python {
+ probe function__entry(const char *, const char *, int, PyFrameObject *);
+ probe function__return(const char *, const char *, int, PyFrameObject *);
+};

View File

@ -1,7 +1,7 @@
diff -up Python-3.2.1/Makefile.pre.in.no-static-lib Python-3.2.1/Makefile.pre.in diff -up Python-3.3.0b1/Makefile.pre.in.no-static-lib Python-3.3.0b1/Makefile.pre.in
--- Python-3.2.1/Makefile.pre.in.no-static-lib 2011-07-09 02:58:52.000000000 -0400 --- Python-3.3.0b1/Makefile.pre.in.no-static-lib 2012-07-20 13:20:34.056605058 -0400
+++ Python-3.2.1/Makefile.pre.in 2011-07-11 11:46:27.381425999 -0400 +++ Python-3.3.0b1/Makefile.pre.in 2012-07-20 13:21:41.540761389 -0400
@@ -425,7 +425,7 @@ coverage: @@ -458,7 +458,7 @@ coverage:
# Build the interpreter # Build the interpreter
@ -9,8 +9,8 @@ diff -up Python-3.2.1/Makefile.pre.in.no-static-lib Python-3.2.1/Makefile.pre.in
+$(BUILDPYTHON): Modules/python.o $(LDLIBRARY) $(PY3LIBRARY) +$(BUILDPYTHON): Modules/python.o $(LDLIBRARY) $(PY3LIBRARY)
$(LINKCC) $(PY_LDFLAGS) $(LINKFORSHARED) -o $@ Modules/python.o $(BLDLIBRARY) $(LIBS) $(MODLIBS) $(SYSLIBS) $(LDLAST) $(LINKCC) $(PY_LDFLAGS) $(LINKFORSHARED) -o $@ Modules/python.o $(BLDLIBRARY) $(LIBS) $(MODLIBS) $(SYSLIBS) $(LDLAST)
platform: $(BUILDPYTHON) platform: $(BUILDPYTHON) $(SYSCONFIGDATA)
@@ -439,18 +439,6 @@ sharedmods: $(BUILDPYTHON) @@ -475,18 +475,6 @@ sharedmods: $(BUILDPYTHON) $(SYSCONFIGDA
*) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' ./$(BUILDPYTHON) -E $(srcdir)/setup.py build;; \ *) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' ./$(BUILDPYTHON) -E $(srcdir)/setup.py build;; \
esac esac
@ -21,7 +21,7 @@ diff -up Python-3.2.1/Makefile.pre.in.no-static-lib Python-3.2.1/Makefile.pre.in
- $(AR) $(ARFLAGS) $@ Modules/getbuildinfo.o - $(AR) $(ARFLAGS) $@ Modules/getbuildinfo.o
- $(AR) $(ARFLAGS) $@ $(PARSER_OBJS) - $(AR) $(ARFLAGS) $@ $(PARSER_OBJS)
- $(AR) $(ARFLAGS) $@ $(OBJECT_OBJS) - $(AR) $(ARFLAGS) $@ $(OBJECT_OBJS)
- $(AR) $(ARFLAGS) $@ $(PYTHON_OBJS) - $(AR) $(ARFLAGS) $@ $(PYTHON_OBJS) Python/frozen.o
- $(AR) $(ARFLAGS) $@ $(MODULE_OBJS) $(SIGNAL_OBJS) - $(AR) $(ARFLAGS) $@ $(MODULE_OBJS) $(SIGNAL_OBJS)
- $(AR) $(ARFLAGS) $@ $(MODOBJS) - $(AR) $(ARFLAGS) $@ $(MODOBJS)
- $(RANLIB) $@ - $(RANLIB) $@
@ -29,7 +29,7 @@ diff -up Python-3.2.1/Makefile.pre.in.no-static-lib Python-3.2.1/Makefile.pre.in
libpython$(LDVERSION).so: $(LIBRARY_OBJS) libpython$(LDVERSION).so: $(LIBRARY_OBJS)
if test $(INSTSONAME) != $(LDLIBRARY); then \ if test $(INSTSONAME) != $(LDLIBRARY); then \
$(BLDSHARED) -Wl,-h$(INSTSONAME) -o $(INSTSONAME) $(LIBRARY_OBJS) $(MODLIBS) $(SHLIBS) $(LIBC) $(LIBM) $(LDLAST); \ $(BLDSHARED) -Wl,-h$(INSTSONAME) -o $(INSTSONAME) $(LIBRARY_OBJS) $(MODLIBS) $(SHLIBS) $(LIBC) $(LIBM) $(LDLAST); \
@@ -540,7 +528,7 @@ Modules/Setup: $(srcdir)/Modules/Setup.d @@ -576,7 +564,7 @@ Modules/Setup: $(srcdir)/Modules/Setup.d
echo "-----------------------------------------------"; \ echo "-----------------------------------------------"; \
fi fi
@ -38,7 +38,7 @@ diff -up Python-3.2.1/Makefile.pre.in.no-static-lib Python-3.2.1/Makefile.pre.in
$(LINKCC) $(PY_LDFLAGS) $(LINKFORSHARED) -o $@ Modules/_testembed.o $(BLDLIBRARY) $(LIBS) $(MODLIBS) $(SYSLIBS) $(LDLAST) $(LINKCC) $(PY_LDFLAGS) $(LINKFORSHARED) -o $@ Modules/_testembed.o $(BLDLIBRARY) $(LIBS) $(MODLIBS) $(SYSLIBS) $(LDLAST)
############################################################################ ############################################################################
@@ -1058,18 +1046,6 @@ libainstall: all python-config @@ -1150,18 +1138,6 @@ libainstall: all python-config
else true; \ else true; \
fi; \ fi; \
done done

View File

@ -1,7 +1,7 @@
diff -up Python-3.1.2/configure.in.more-configuration-flags Python-3.1.2/configure.in diff -up Python-3.3.0b1/configure.ac.more-configuration-flags Python-3.3.0b1/configure.ac
--- Python-3.1.2/configure.in.more-configuration-flags 2010-05-25 12:16:48.602875960 -0400 --- Python-3.3.0b1/configure.ac.more-configuration-flags 2012-07-20 13:25:33.232864839 -0400
+++ Python-3.1.2/configure.in 2010-05-25 12:16:48.609879553 -0400 +++ Python-3.3.0b1/configure.ac 2012-07-20 13:25:33.314863815 -0400
@@ -2443,6 +2443,30 @@ else AC_MSG_RESULT(no) @@ -2585,6 +2585,30 @@ else AC_MSG_RESULT(no)
fi], fi],
[AC_MSG_RESULT(no)]) [AC_MSG_RESULT(no)])
@ -32,12 +32,12 @@ diff -up Python-3.1.2/configure.in.more-configuration-flags Python-3.1.2/configu
# Check for Python-specific malloc support # Check for Python-specific malloc support
AC_MSG_CHECKING(for --with-pymalloc) AC_MSG_CHECKING(for --with-pymalloc)
AC_ARG_WITH(pymalloc, AC_ARG_WITH(pymalloc,
diff -up Python-3.1.2/pyconfig.h.in.more-configuration-flags Python-3.1.2/pyconfig.h.in diff -up Python-3.3.0b1/pyconfig.h.in.more-configuration-flags Python-3.3.0b1/pyconfig.h.in
--- Python-3.1.2/pyconfig.h.in.more-configuration-flags 2010-05-25 12:16:48.000000000 -0400 --- Python-3.3.0b1/pyconfig.h.in.more-configuration-flags 2012-07-20 13:25:33.000000000 -0400
+++ Python-3.1.2/pyconfig.h.in 2010-05-25 12:17:54.428126399 -0400 +++ Python-3.3.0b1/pyconfig.h.in 2012-07-20 13:26:02.826494869 -0400
@@ -18,6 +18,12 @@ @@ -12,6 +12,12 @@
/* Define if you have the Mach cthreads package */ support for AIX C++ shared extension modules. */
#undef C_THREADS #undef AIX_GENUINE_CPLUSPLUS
+/* Define to keep records on function call invocation */ +/* Define to keep records on function call invocation */
+#undef CALL_PROFILE +#undef CALL_PROFILE

View File

@ -1,18 +1,10 @@
diff -up Python-3.2a1/Modules/posixmodule.c.statvfs-f-flag-constants Python-3.2a1/Modules/posixmodule.c diff -up Python-3.3.0b1/Modules/posixmodule.c.statvfs-f_flag-constants Python-3.3.0b1/Modules/posixmodule.c
--- Python-3.2a1/Modules/posixmodule.c.statvfs-f-flag-constants 2010-07-23 09:53:51.000000000 -0400 --- Python-3.3.0b1/Modules/posixmodule.c.statvfs-f_flag-constants 2012-06-26 16:19:54.000000000 -0400
+++ Python-3.2a1/Modules/posixmodule.c 2010-08-02 16:39:38.756000423 -0400 +++ Python-3.3.0b1/Modules/posixmodule.c 2012-07-20 13:39:18.595546387 -0400
@@ -8173,6 +8173,43 @@ all_ins(PyObject *d) @@ -11665,6 +11665,35 @@ all_ins(PyObject *d)
#endif if (ins(d, "ST_NOSUID", (long)ST_NOSUID)) return -1;
#endif #endif /* ST_NOSUID */
+ /* These came from statvfs.h */
+#ifdef ST_RDONLY
+ if (ins(d, "ST_RDONLY", (long)ST_RDONLY)) return -1;
+#endif /* ST_RDONLY */
+#ifdef ST_NOSUID
+ if (ins(d, "ST_NOSUID", (long)ST_NOSUID)) return -1;
+#endif /* ST_NOSUID */
+
+ /* GNU extensions */ + /* GNU extensions */
+#ifdef ST_NODEV +#ifdef ST_NODEV
+ if (ins(d, "ST_NODEV", (long)ST_NODEV)) return -1; + if (ins(d, "ST_NODEV", (long)ST_NODEV)) return -1;
@ -42,6 +34,6 @@ diff -up Python-3.2a1/Modules/posixmodule.c.statvfs-f-flag-constants Python-3.2a
+ if (ins(d, "ST_RELATIME", (long)ST_RELATIME)) return -1; + if (ins(d, "ST_RELATIME", (long)ST_RELATIME)) return -1;
+#endif /* ST_RELATIME */ +#endif /* ST_RELATIME */
+ +
#if defined(PYOS_OS2) /* FreeBSD sendfile() constants */
if (insertvalues(d)) return -1; #ifdef SF_NODISKIO
#endif if (ins(d, "SF_NODISKIO", (long)SF_NODISKIO)) return -1;

View File

@ -1,13 +1,21 @@
diff -up Python-3.2b2/Lib/test/test_sys.py.fix-test-sys-COUNT_ALLOCS Python-3.2b2/Lib/test/test_sys.py diff -up Python-3.3.0b1/Lib/test/test_sys.py.fix-COUNT_ALLOCS-failure-in-test_sys Python-3.3.0b1/Lib/test/test_sys.py
--- Python-3.2b2/Lib/test/test_sys.py.fix-test-sys-COUNT_ALLOCS 2010-12-28 20:52:43.236310184 -0500 --- Python-3.3.0b1/Lib/test/test_sys.py.fix-COUNT_ALLOCS-failure-in-test_sys 2012-07-23 11:18:52.524602807 -0400
+++ Python-3.2b2/Lib/test/test_sys.py 2010-12-28 20:58:09.164184094 -0500 +++ Python-3.3.0b1/Lib/test/test_sys.py 2012-07-23 11:25:54.641325620 -0400
@@ -817,6 +817,9 @@ class SizeofTest(unittest.TestCase): @@ -863,12 +863,17 @@ class SizeofTest(unittest.TestCase):
# (PyTypeObject + PyNumberMethods + PyMappingMethods + # type
# PySequenceMethods + PyBufferProcs) # static type: PyTypeObject
s = size(vh + 'P2P15Pl4PP9PP11PI') + size('16Pi17P 3P 10P 2P 2P') s = size(vh + 'P2P15Pl4PP9PP11PI')
+ # COUNT_ALLOCS adds a further 3 Py_ssize_t and 2 pointers: + # COUNT_ALLOCS adds a further 3 Py_ssize_t and 2 pointers:
+ if hasattr(sys, 'getcounts'): + if hasattr(sys, 'getcounts'):
+ s += size('3P2P') + s += size('3P2P')
check(int, s) check(int, s)
# (PyTypeObject + PyNumberMethods + PyMappingMethods +
# PySequenceMethods + PyBufferProcs + 4P)
s = size(vh + 'P2P15Pl4PP9PP11PI') + size('34P 3P 10P 2P 4P')
# Separate block for PyDictKeysObject with 4 entries
s += size("PPPP") + 4*size("PPP")
+ if hasattr(sys, 'getcounts'):
+ s += size('3P2P')
# class # class
class newstyleclass(object): pass class newstyleclass(object): pass
check(newstyleclass, s)

View File

@ -1,590 +0,0 @@
diff -up Python-3.2.2/Include/dictobject.h.add-debug-malloc-stats Python-3.2.2/Include/dictobject.h
--- Python-3.2.2/Include/dictobject.h.add-debug-malloc-stats 2011-09-03 12:16:40.000000000 -0400
+++ Python-3.2.2/Include/dictobject.h 2011-09-16 18:57:24.969825060 -0400
@@ -156,6 +156,8 @@ PyAPI_FUNC(PyObject *) PyDict_GetItemStr
PyAPI_FUNC(int) PyDict_SetItemString(PyObject *dp, const char *key, PyObject *item);
PyAPI_FUNC(int) PyDict_DelItemString(PyObject *dp, const char *key);
+PyAPI_FUNC(void) _PyDict_DebugMallocStats(FILE *out);
+
#ifdef __cplusplus
}
#endif
diff -up Python-3.2.2/Include/floatobject.h.add-debug-malloc-stats Python-3.2.2/Include/floatobject.h
--- Python-3.2.2/Include/floatobject.h.add-debug-malloc-stats 2011-09-03 12:16:40.000000000 -0400
+++ Python-3.2.2/Include/floatobject.h 2011-09-16 18:57:24.970825060 -0400
@@ -110,6 +110,8 @@ PyAPI_FUNC(double) _PyFloat_Unpack8(cons
/* free list api */
PyAPI_FUNC(int) PyFloat_ClearFreeList(void);
+PyAPI_FUNC(void) _PyFloat_DebugMallocStats(FILE* out);
+
/* Format the object based on the format_spec, as defined in PEP 3101
(Advanced String Formatting). */
PyAPI_FUNC(PyObject *) _PyFloat_FormatAdvanced(PyObject *obj,
diff -up Python-3.2.2/Include/frameobject.h.add-debug-malloc-stats Python-3.2.2/Include/frameobject.h
--- Python-3.2.2/Include/frameobject.h.add-debug-malloc-stats 2011-09-03 12:16:40.000000000 -0400
+++ Python-3.2.2/Include/frameobject.h 2011-09-16 18:57:24.970825060 -0400
@@ -79,6 +79,8 @@ PyAPI_FUNC(void) PyFrame_FastToLocals(Py
PyAPI_FUNC(int) PyFrame_ClearFreeList(void);
+PyAPI_FUNC(void) _PyFrame_DebugMallocStats(FILE *out);
+
/* Return the line of code the frame is currently executing. */
PyAPI_FUNC(int) PyFrame_GetLineNumber(PyFrameObject *);
diff -up Python-3.2.2/Include/listobject.h.add-debug-malloc-stats Python-3.2.2/Include/listobject.h
--- Python-3.2.2/Include/listobject.h.add-debug-malloc-stats 2011-09-03 12:16:40.000000000 -0400
+++ Python-3.2.2/Include/listobject.h 2011-09-16 18:57:24.971825060 -0400
@@ -71,6 +71,8 @@ PyAPI_FUNC(PyObject *) _PyList_Extend(Py
#define PyList_GET_SIZE(op) Py_SIZE(op)
#endif
+PyAPI_FUNC(void) _PyList_DebugMallocStats(FILE *out);
+
#ifdef __cplusplus
}
#endif
diff -up Python-3.2.2/Include/methodobject.h.add-debug-malloc-stats Python-3.2.2/Include/methodobject.h
--- Python-3.2.2/Include/methodobject.h.add-debug-malloc-stats 2011-09-03 12:16:40.000000000 -0400
+++ Python-3.2.2/Include/methodobject.h 2011-09-16 18:57:24.971825060 -0400
@@ -81,6 +81,10 @@ typedef struct {
PyAPI_FUNC(int) PyCFunction_ClearFreeList(void);
+PyAPI_FUNC(void) _PyCFunction_DebugMallocStats(FILE *out);
+PyAPI_FUNC(void) _PyMethod_DebugMallocStats(FILE *out);
+
+
#ifdef __cplusplus
}
#endif
diff -up Python-3.2.2/Include/object.h.add-debug-malloc-stats Python-3.2.2/Include/object.h
--- Python-3.2.2/Include/object.h.add-debug-malloc-stats 2011-09-03 12:16:40.000000000 -0400
+++ Python-3.2.2/Include/object.h 2011-09-16 18:57:24.972825060 -0400
@@ -919,6 +919,13 @@ PyAPI_DATA(PyObject *) _PyTrash_delete_l
else \
_PyTrash_deposit_object((PyObject*)op);
+PyAPI_FUNC(void)
+_PyDebugAllocatorStats(FILE *out, const char *block_name, int num_blocks,
+ size_t sizeof_block);
+
+PyAPI_FUNC(void)
+_PyObject_DebugTypeStats(FILE *out);
+
#ifdef __cplusplus
}
#endif
diff -up Python-3.2.2/Include/objimpl.h.add-debug-malloc-stats Python-3.2.2/Include/objimpl.h
--- Python-3.2.2/Include/objimpl.h.add-debug-malloc-stats 2011-09-03 12:16:40.000000000 -0400
+++ Python-3.2.2/Include/objimpl.h 2011-09-16 18:57:24.972825060 -0400
@@ -101,13 +101,13 @@ PyAPI_FUNC(void) PyObject_Free(void *);
/* Macros */
#ifdef WITH_PYMALLOC
+PyAPI_FUNC(void) _PyObject_DebugMallocStats(FILE *out);
#ifdef PYMALLOC_DEBUG /* WITH_PYMALLOC && PYMALLOC_DEBUG */
PyAPI_FUNC(void *) _PyObject_DebugMalloc(size_t nbytes);
PyAPI_FUNC(void *) _PyObject_DebugRealloc(void *p, size_t nbytes);
PyAPI_FUNC(void) _PyObject_DebugFree(void *p);
PyAPI_FUNC(void) _PyObject_DebugDumpAddress(const void *p);
PyAPI_FUNC(void) _PyObject_DebugCheckAddress(const void *p);
-PyAPI_FUNC(void) _PyObject_DebugMallocStats(void);
PyAPI_FUNC(void *) _PyObject_DebugMallocApi(char api, size_t nbytes);
PyAPI_FUNC(void *) _PyObject_DebugReallocApi(char api, void *p, size_t nbytes);
PyAPI_FUNC(void) _PyObject_DebugFreeApi(char api, void *p);
diff -up Python-3.2.2/Include/setobject.h.add-debug-malloc-stats Python-3.2.2/Include/setobject.h
--- Python-3.2.2/Include/setobject.h.add-debug-malloc-stats 2011-09-16 19:10:58.448817301 -0400
+++ Python-3.2.2/Include/setobject.h 2011-09-16 19:12:16.343816559 -0400
@@ -101,6 +101,8 @@ PyAPI_FUNC(PyObject *) PySet_Pop(PyObjec
PyAPI_FUNC(int) _PySet_Update(PyObject *set, PyObject *iterable);
#endif
+PyAPI_FUNC(void) _PySet_DebugMallocStats(FILE *out);
+
#ifdef __cplusplus
}
#endif
diff -up Python-3.2.2/Include/tupleobject.h.add-debug-malloc-stats Python-3.2.2/Include/tupleobject.h
--- Python-3.2.2/Include/tupleobject.h.add-debug-malloc-stats 2011-09-16 19:10:45.540817425 -0400
+++ Python-3.2.2/Include/tupleobject.h 2011-09-16 19:12:41.446816320 -0400
@@ -63,6 +63,7 @@ PyAPI_FUNC(void) _PyTuple_MaybeUntrack(P
#endif
PyAPI_FUNC(int) PyTuple_ClearFreeList(void);
+PyAPI_FUNC(void) _PyTuple_DebugMallocStats(FILE *out);
#ifdef __cplusplus
}
diff -up Python-3.2.2/Include/unicodeobject.h.add-debug-malloc-stats Python-3.2.2/Include/unicodeobject.h
--- Python-3.2.2/Include/unicodeobject.h.add-debug-malloc-stats 2011-09-03 12:16:40.000000000 -0400
+++ Python-3.2.2/Include/unicodeobject.h 2011-09-16 18:57:24.973825060 -0400
@@ -1670,6 +1670,8 @@ PyAPI_FUNC(Py_UNICODE*) PyUnicode_AsUnic
);
#endif /* Py_LIMITED_API */
+PyAPI_FUNC(void) _PyUnicode_DebugMallocStats(FILE *out);
+
#ifdef __cplusplus
}
#endif
diff -up Python-3.2.2/Lib/test/test_sys.py.add-debug-malloc-stats Python-3.2.2/Lib/test/test_sys.py
--- Python-3.2.2/Lib/test/test_sys.py.add-debug-malloc-stats 2011-09-16 18:57:24.940825060 -0400
+++ Python-3.2.2/Lib/test/test_sys.py 2011-09-16 19:23:50.415809940 -0400
@@ -564,6 +564,18 @@ class SysModuleTest(unittest.TestCase):
expected = None
self.check_fsencoding(fs_encoding, expected)
+ def test_debugmallocstats(self):
+ # Test sys._debugmallocstats()
+
+ import subprocess
+
+ # Verify writing to stderr:
+ p = subprocess.Popen([sys.executable,
+ '-c', 'import sys; sys._debugmallocstats()'],
+ stderr=subprocess.PIPE)
+ out, err = p.communicate()
+ p.wait()
+ self.assertIn(b"arenas allocated current", err)
class SizeofTest(unittest.TestCase):
diff -up Python-3.2.2/Objects/classobject.c.add-debug-malloc-stats Python-3.2.2/Objects/classobject.c
--- Python-3.2.2/Objects/classobject.c.add-debug-malloc-stats 2011-09-03 12:16:47.000000000 -0400
+++ Python-3.2.2/Objects/classobject.c 2011-09-16 18:57:24.975825060 -0400
@@ -399,6 +399,15 @@ PyMethod_Fini(void)
(void)PyMethod_ClearFreeList();
}
+/* Print summary info about the state of the optimized allocator */
+void
+_PyMethod_DebugMallocStats(FILE *out)
+{
+ _PyDebugAllocatorStats(out,
+ "free PyMethodObject",
+ numfree, sizeof(PyMethodObject));
+}
+
/* ------------------------------------------------------------------------
* instance method
*/
diff -up Python-3.2.2/Objects/dictobject.c.add-debug-malloc-stats Python-3.2.2/Objects/dictobject.c
--- Python-3.2.2/Objects/dictobject.c.add-debug-malloc-stats 2011-09-03 12:16:47.000000000 -0400
+++ Python-3.2.2/Objects/dictobject.c 2011-09-16 18:57:24.976825060 -0400
@@ -217,6 +217,15 @@ show_track(void)
static PyDictObject *free_list[PyDict_MAXFREELIST];
static int numfree = 0;
+/* Print summary info about the state of the optimized allocator */
+void
+_PyDict_DebugMallocStats(FILE *out)
+{
+ _PyDebugAllocatorStats(out,
+ "free PyDictObject", numfree, sizeof(PyDictObject));
+}
+
+
void
PyDict_Fini(void)
{
diff -up Python-3.2.2/Objects/floatobject.c.add-debug-malloc-stats Python-3.2.2/Objects/floatobject.c
--- Python-3.2.2/Objects/floatobject.c.add-debug-malloc-stats 2011-09-03 12:16:47.000000000 -0400
+++ Python-3.2.2/Objects/floatobject.c 2011-09-16 18:57:24.981825060 -0400
@@ -50,6 +50,22 @@ typedef struct _floatblock PyFloatBlock;
static PyFloatBlock *block_list = NULL;
static PyFloatObject *free_list = NULL;
+/* Print summary info about the state of the optimized allocator */
+void
+_PyFloat_DebugMallocStats(FILE *out)
+{
+ int num_blocks = 0;
+ PyFloatBlock *block;
+
+ /* Walk the block list, counting */
+ for (block = block_list; block ; block = block->next) {
+ num_blocks++;
+ }
+
+ _PyDebugAllocatorStats(out,
+ "PyFloatBlock", num_blocks, sizeof(PyFloatBlock));
+}
+
static PyFloatObject *
fill_free_list(void)
{
diff -up Python-3.2.2/Objects/frameobject.c.add-debug-malloc-stats Python-3.2.2/Objects/frameobject.c
--- Python-3.2.2/Objects/frameobject.c.add-debug-malloc-stats 2011-09-03 12:16:47.000000000 -0400
+++ Python-3.2.2/Objects/frameobject.c 2011-09-16 18:57:24.982825060 -0400
@@ -953,3 +953,13 @@ PyFrame_Fini(void)
Py_XDECREF(builtin_object);
builtin_object = NULL;
}
+
+/* Print summary info about the state of the optimized allocator */
+void
+_PyFrame_DebugMallocStats(FILE *out)
+{
+ _PyDebugAllocatorStats(out,
+ "free PyFrameObject",
+ numfree, sizeof(PyFrameObject));
+}
+
diff -up Python-3.2.2/Objects/listobject.c.add-debug-malloc-stats Python-3.2.2/Objects/listobject.c
--- Python-3.2.2/Objects/listobject.c.add-debug-malloc-stats 2011-09-03 12:16:47.000000000 -0400
+++ Python-3.2.2/Objects/listobject.c 2011-09-16 18:57:24.983825060 -0400
@@ -109,6 +109,15 @@ PyList_Fini(void)
}
}
+/* Print summary info about the state of the optimized allocator */
+void
+_PyList_DebugMallocStats(FILE *out)
+{
+ _PyDebugAllocatorStats(out,
+ "free PyListObject",
+ numfree, sizeof(PyListObject));
+}
+
PyObject *
PyList_New(Py_ssize_t size)
{
diff -up Python-3.2.2/Objects/methodobject.c.add-debug-malloc-stats Python-3.2.2/Objects/methodobject.c
--- Python-3.2.2/Objects/methodobject.c.add-debug-malloc-stats 2011-09-03 12:16:47.000000000 -0400
+++ Python-3.2.2/Objects/methodobject.c 2011-09-16 18:57:24.983825060 -0400
@@ -303,6 +303,15 @@ PyCFunction_Fini(void)
(void)PyCFunction_ClearFreeList();
}
+/* Print summary info about the state of the optimized allocator */
+void
+_PyCFunction_DebugMallocStats(FILE *out)
+{
+ _PyDebugAllocatorStats(out,
+ "free PyCFunction",
+ numfree, sizeof(PyCFunction));
+}
+
/* PyCFunction_New() is now just a macro that calls PyCFunction_NewEx(),
but it's part of the API so we need to keep a function around that
existing C extensions can call.
diff -up Python-3.2.2/Objects/object.c.add-debug-malloc-stats Python-3.2.2/Objects/object.c
--- Python-3.2.2/Objects/object.c.add-debug-malloc-stats 2011-09-03 12:16:47.000000000 -0400
+++ Python-3.2.2/Objects/object.c 2011-09-16 19:04:20.351821098 -0400
@@ -1781,6 +1781,19 @@ PyMem_Free(void *p)
PyMem_FREE(p);
}
+void
+_PyObject_DebugTypeStats(FILE *out)
+{
+ _PyCFunction_DebugMallocStats(out);
+ _PyDict_DebugMallocStats(out);
+ _PyFloat_DebugMallocStats(out);
+ _PyFrame_DebugMallocStats(out);
+ _PyList_DebugMallocStats(out);
+ _PyMethod_DebugMallocStats(out);
+ _PySet_DebugMallocStats(out);
+ _PyTuple_DebugMallocStats(out);
+ _PyUnicode_DebugMallocStats(out);
+}
/* These methods are used to control infinite recursion in repr, str, print,
etc. Container objects that may recursively contain themselves,
diff -up Python-3.2.2/Objects/obmalloc.c.add-debug-malloc-stats Python-3.2.2/Objects/obmalloc.c
--- Python-3.2.2/Objects/obmalloc.c.add-debug-malloc-stats 2011-09-03 12:16:47.000000000 -0400
+++ Python-3.2.2/Objects/obmalloc.c 2011-09-16 18:57:24.985825060 -0400
@@ -508,12 +508,10 @@ static struct arena_object* usable_arena
/* Number of arenas allocated that haven't been free()'d. */
static size_t narenas_currently_allocated = 0;
-#ifdef PYMALLOC_DEBUG
/* Total number of times malloc() called to allocate an arena. */
static size_t ntimes_arena_allocated = 0;
/* High water mark (max value ever seen) for narenas_currently_allocated. */
static size_t narenas_highwater = 0;
-#endif
/* Allocate a new arena. If we run out of memory, return NULL. Else
* allocate a new arena, and return the address of an arena_object
@@ -528,7 +526,7 @@ new_arena(void)
#ifdef PYMALLOC_DEBUG
if (Py_GETENV("PYTHONMALLOCSTATS"))
- _PyObject_DebugMallocStats();
+ _PyObject_DebugMallocStats(stderr);
#endif
if (unused_arena_objects == NULL) {
uint i;
@@ -588,11 +586,9 @@ new_arena(void)
}
++narenas_currently_allocated;
-#ifdef PYMALLOC_DEBUG
++ntimes_arena_allocated;
if (narenas_currently_allocated > narenas_highwater)
narenas_highwater = narenas_currently_allocated;
-#endif
arenaobj->freepools = NULL;
/* pool_address <- first pool-aligned address in the arena
nfreepools <- number of whole pools that fit after alignment */
@@ -1694,17 +1690,19 @@ _PyObject_DebugDumpAddress(const void *p
}
}
+#endif /* PYMALLOC_DEBUG */
+
static size_t
-printone(const char* msg, size_t value)
+printone(FILE *out, const char* msg, size_t value)
{
int i, k;
char buf[100];
size_t origvalue = value;
- fputs(msg, stderr);
+ fputs(msg, out);
for (i = (int)strlen(msg); i < 35; ++i)
- fputc(' ', stderr);
- fputc('=', stderr);
+ fputc(' ', out);
+ fputc('=', out);
/* Write the value with commas. */
i = 22;
@@ -1725,17 +1723,32 @@ printone(const char* msg, size_t value)
while (i >= 0)
buf[i--] = ' ';
- fputs(buf, stderr);
+ fputs(buf, out);
return origvalue;
}
-/* Print summary info to stderr about the state of pymalloc's structures.
+void
+_PyDebugAllocatorStats(FILE *out,
+ const char *block_name, int num_blocks, size_t sizeof_block)
+{
+ char buf1[128];
+ char buf2[128];
+ PyOS_snprintf(buf1, sizeof(buf1),
+ "%d %ss * %zd bytes each",
+ num_blocks, block_name, sizeof_block);
+ PyOS_snprintf(buf2, sizeof(buf2),
+ "%48s ", buf1);
+ (void)printone(out, buf2, num_blocks * sizeof_block);
+}
+
+
+/* Print summary info to "out" about the state of pymalloc's structures.
* In Py_DEBUG mode, also perform some expensive internal consistency
* checks.
*/
void
-_PyObject_DebugMallocStats(void)
+_PyObject_DebugMallocStats(FILE *out)
{
uint i;
const uint numclasses = SMALL_REQUEST_THRESHOLD >> ALIGNMENT_SHIFT;
@@ -1764,7 +1777,7 @@ _PyObject_DebugMallocStats(void)
size_t total;
char buf[128];
- fprintf(stderr, "Small block threshold = %d, in %u size classes.\n",
+ fprintf(out, "Small block threshold = %d, in %u size classes.\n",
SMALL_REQUEST_THRESHOLD, numclasses);
for (i = 0; i < numclasses; ++i)
@@ -1820,10 +1833,10 @@ _PyObject_DebugMallocStats(void)
}
assert(narenas == narenas_currently_allocated);
- fputc('\n', stderr);
+ fputc('\n', out);
fputs("class size num pools blocks in use avail blocks\n"
"----- ---- --------- ------------- ------------\n",
- stderr);
+ out);
for (i = 0; i < numclasses; ++i) {
size_t p = numpools[i];
@@ -1834,7 +1847,7 @@ _PyObject_DebugMallocStats(void)
assert(b == 0 && f == 0);
continue;
}
- fprintf(stderr, "%5u %6u "
+ fprintf(out, "%5u %6u "
"%11" PY_FORMAT_SIZE_T "u "
"%15" PY_FORMAT_SIZE_T "u "
"%13" PY_FORMAT_SIZE_T "u\n",
@@ -1844,36 +1857,35 @@ _PyObject_DebugMallocStats(void)
pool_header_bytes += p * POOL_OVERHEAD;
quantization += p * ((POOL_SIZE - POOL_OVERHEAD) % size);
}
- fputc('\n', stderr);
- (void)printone("# times object malloc called", serialno);
-
- (void)printone("# arenas allocated total", ntimes_arena_allocated);
- (void)printone("# arenas reclaimed", ntimes_arena_allocated - narenas);
- (void)printone("# arenas highwater mark", narenas_highwater);
- (void)printone("# arenas allocated current", narenas);
+ fputc('\n', out);
+#ifdef PYMALLOC_DEBUG
+ (void)printone(out, "# times object malloc called", serialno);
+#endif
+ (void)printone(out, "# arenas allocated total", ntimes_arena_allocated);
+ (void)printone(out, "# arenas reclaimed", ntimes_arena_allocated - narenas);
+ (void)printone(out, "# arenas highwater mark", narenas_highwater);
+ (void)printone(out, "# arenas allocated current", narenas);
PyOS_snprintf(buf, sizeof(buf),
"%" PY_FORMAT_SIZE_T "u arenas * %d bytes/arena",
narenas, ARENA_SIZE);
- (void)printone(buf, narenas * ARENA_SIZE);
+ (void)printone(out, buf, narenas * ARENA_SIZE);
- fputc('\n', stderr);
+ fputc('\n', out);
- total = printone("# bytes in allocated blocks", allocated_bytes);
- total += printone("# bytes in available blocks", available_bytes);
+ total = printone(out, "# bytes in allocated blocks", allocated_bytes);
+ total += printone(out, "# bytes in available blocks", available_bytes);
PyOS_snprintf(buf, sizeof(buf),
"%u unused pools * %d bytes", numfreepools, POOL_SIZE);
- total += printone(buf, (size_t)numfreepools * POOL_SIZE);
+ total += printone(out, buf, (size_t)numfreepools * POOL_SIZE);
- total += printone("# bytes lost to pool headers", pool_header_bytes);
- total += printone("# bytes lost to quantization", quantization);
- total += printone("# bytes lost to arena alignment", arena_alignment);
- (void)printone("Total", total);
+ total += printone(out, "# bytes lost to pool headers", pool_header_bytes);
+ total += printone(out, "# bytes lost to quantization", quantization);
+ total += printone(out, "# bytes lost to arena alignment", arena_alignment);
+ (void)printone(out, "Total", total);
}
-#endif /* PYMALLOC_DEBUG */
-
#ifdef Py_USING_MEMORY_DEBUGGER
/* Make this function last so gcc won't inline it since the definition is
* after the reference.
diff -up Python-3.2.2/Objects/setobject.c.add-debug-malloc-stats Python-3.2.2/Objects/setobject.c
--- Python-3.2.2/Objects/setobject.c.add-debug-malloc-stats 2011-09-03 12:16:47.000000000 -0400
+++ Python-3.2.2/Objects/setobject.c 2011-09-16 18:57:24.986825060 -0400
@@ -1090,6 +1090,16 @@ PySet_Fini(void)
Py_CLEAR(emptyfrozenset);
}
+/* Print summary info about the state of the optimized allocator */
+void
+_PySet_DebugMallocStats(FILE *out)
+{
+ _PyDebugAllocatorStats(out,
+ "free PySetObject",
+ numfree, sizeof(PySetObject));
+}
+
+
static PyObject *
set_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
{
diff -up Python-3.2.2/Objects/tupleobject.c.add-debug-malloc-stats Python-3.2.2/Objects/tupleobject.c
--- Python-3.2.2/Objects/tupleobject.c.add-debug-malloc-stats 2011-09-03 12:16:47.000000000 -0400
+++ Python-3.2.2/Objects/tupleobject.c 2011-09-16 18:57:24.987825060 -0400
@@ -44,6 +44,22 @@ show_track(void)
}
#endif
+/* Print summary info about the state of the optimized allocator */
+void
+_PyTuple_DebugMallocStats(FILE *out)
+{
+#if PyTuple_MAXSAVESIZE > 0
+ int i;
+ char buf[128];
+ for (i = 1; i < PyTuple_MAXSAVESIZE; i++) {
+ PyOS_snprintf(buf, sizeof(buf),
+ "free %d-sized PyTupleObject", i);
+ _PyDebugAllocatorStats(out,
+ buf,
+ numfree[i], _PyObject_VAR_SIZE(&PyTuple_Type, i));
+ }
+#endif
+}
PyObject *
PyTuple_New(register Py_ssize_t size)
diff -up Python-3.2.2/Objects/unicodeobject.c.add-debug-malloc-stats Python-3.2.2/Objects/unicodeobject.c
--- Python-3.2.2/Objects/unicodeobject.c.add-debug-malloc-stats 2011-09-03 12:16:47.000000000 -0400
+++ Python-3.2.2/Objects/unicodeobject.c 2011-09-16 18:57:24.990825060 -0400
@@ -10063,6 +10063,12 @@ _PyUnicode_Fini(void)
(void)PyUnicode_ClearFreeList();
}
+void _PyUnicode_DebugMallocStats(FILE *out)
+{
+ _PyDebugAllocatorStats(out, "free PyUnicodeObject", numfree,
+ sizeof(PyUnicodeObject));
+}
+
void
PyUnicode_InternInPlace(PyObject **p)
{
diff -up Python-3.2.2/Python/pythonrun.c.add-debug-malloc-stats Python-3.2.2/Python/pythonrun.c
--- Python-3.2.2/Python/pythonrun.c.add-debug-malloc-stats 2011-09-16 19:24:44.747809422 -0400
+++ Python-3.2.2/Python/pythonrun.c 2011-09-16 19:25:00.024809277 -0400
@@ -547,7 +547,7 @@ Py_Finalize(void)
#endif /* Py_TRACE_REFS */
#ifdef PYMALLOC_DEBUG
if (Py_GETENV("PYTHONMALLOCSTATS"))
- _PyObject_DebugMallocStats();
+ _PyObject_DebugMallocStats(stderr);
#endif
call_ll_exitfuncs();
diff -up Python-3.2.2/Python/sysmodule.c.add-debug-malloc-stats Python-3.2.2/Python/sysmodule.c
--- Python-3.2.2/Python/sysmodule.c.add-debug-malloc-stats 2011-09-03 12:16:49.000000000 -0400
+++ Python-3.2.2/Python/sysmodule.c 2011-09-16 19:18:45.806812845 -0400
@@ -994,6 +994,25 @@ a 11-tuple where the entries in the tupl
extern "C" {
#endif
+static PyObject *
+sys_debugmallocstats(PyObject *self, PyObject *args)
+{
+ _PyObject_DebugMallocStats(stderr);
+ fputc('\n', stderr);
+ _PyObject_DebugTypeStats(stderr);
+
+ Py_RETURN_NONE;
+}
+PyDoc_STRVAR(debugmallocstats_doc,
+"_debugmallocstats([file])\n\
+\n\
+Print summary info to stderr about the state of\n\
+pymalloc's structures.\n\
+\n\
+In Py_DEBUG mode, also perform some expensive internal consistency\n\
+checks.\n\
+");
+
#ifdef Py_TRACE_REFS
/* Defined in objects.c because it uses static globals if that file */
extern PyObject *_Py_GetObjects(PyObject *, PyObject *);
@@ -1090,6 +1109,8 @@ static PyMethodDef sys_methods[] = {
{"settrace", sys_settrace, METH_O, settrace_doc},
{"gettrace", sys_gettrace, METH_NOARGS, gettrace_doc},
{"call_tracing", sys_call_tracing, METH_VARARGS, call_tracing_doc},
+ {"_debugmallocstats", sys_debugmallocstats, METH_VARARGS,
+ debugmallocstats_doc},
{NULL, NULL} /* sentinel */
};

View File

@ -1,6 +1,6 @@
diff -up Python-3.2.3/Include/modsupport.h.uid-gid-overflows Python-3.2.3/Include/modsupport.h diff -up Python-3.3.0b1/Include/modsupport.h.uid-gid-overflows Python-3.3.0b1/Include/modsupport.h
--- Python-3.2.3/Include/modsupport.h.uid-gid-overflows 2012-04-11 02:54:01.000000000 -0400 --- Python-3.3.0b1/Include/modsupport.h.uid-gid-overflows 2012-06-26 16:19:40.000000000 -0400
+++ Python-3.2.3/Include/modsupport.h 2012-06-18 17:20:38.193527374 -0400 +++ Python-3.3.0b1/Include/modsupport.h 2012-07-20 14:21:46.854688763 -0400
@@ -8,6 +8,7 @@ extern "C" { @@ -8,6 +8,7 @@ extern "C" {
/* Module support interface */ /* Module support interface */
@ -9,7 +9,7 @@ diff -up Python-3.2.3/Include/modsupport.h.uid-gid-overflows Python-3.2.3/Includ
/* If PY_SSIZE_T_CLEAN is defined, each functions treats #-specifier /* If PY_SSIZE_T_CLEAN is defined, each functions treats #-specifier
to mean Py_ssize_t */ to mean Py_ssize_t */
@@ -122,6 +123,17 @@ PyAPI_FUNC(PyObject *) PyModule_Create2( @@ -125,6 +126,17 @@ PyAPI_FUNC(PyObject *) PyModule_Create2(
PyAPI_DATA(char *) _Py_PackageContext; PyAPI_DATA(char *) _Py_PackageContext;
#endif #endif
@ -27,10 +27,10 @@ diff -up Python-3.2.3/Include/modsupport.h.uid-gid-overflows Python-3.2.3/Includ
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
diff -up Python-3.2.3/Lib/test/test_os.py.uid-gid-overflows Python-3.2.3/Lib/test/test_os.py diff -up Python-3.3.0b1/Lib/test/test_os.py.uid-gid-overflows Python-3.3.0b1/Lib/test/test_os.py
--- Python-3.2.3/Lib/test/test_os.py.uid-gid-overflows 2012-04-11 02:54:05.000000000 -0400 --- Python-3.3.0b1/Lib/test/test_os.py.uid-gid-overflows 2012-06-26 16:19:48.000000000 -0400
+++ Python-3.2.3/Lib/test/test_os.py 2012-06-18 17:20:18.360775320 -0400 +++ Python-3.3.0b1/Lib/test/test_os.py 2012-07-20 14:21:46.856688739 -0400
@@ -885,30 +885,36 @@ if sys.platform != 'win32': @@ -1174,30 +1174,36 @@ if sys.platform != 'win32':
def test_setuid(self): def test_setuid(self):
if os.getuid() != 0: if os.getuid() != 0:
self.assertRaises(os.error, os.setuid, 0) self.assertRaises(os.error, os.setuid, 0)
@ -67,7 +67,7 @@ diff -up Python-3.2.3/Lib/test/test_os.py.uid-gid-overflows Python-3.2.3/Lib/tes
self.assertRaises(OverflowError, os.setreuid, 1<<32, 0) self.assertRaises(OverflowError, os.setreuid, 1<<32, 0)
self.assertRaises(OverflowError, os.setreuid, 0, 1<<32) self.assertRaises(OverflowError, os.setreuid, 0, 1<<32)
@@ -923,6 +929,8 @@ if sys.platform != 'win32': @@ -1212,6 +1218,8 @@ if sys.platform != 'win32':
def test_setregid(self): def test_setregid(self):
if os.getuid() != 0: if os.getuid() != 0:
self.assertRaises(os.error, os.setregid, 0, 0) self.assertRaises(os.error, os.setregid, 0, 0)
@ -76,20 +76,16 @@ diff -up Python-3.2.3/Lib/test/test_os.py.uid-gid-overflows Python-3.2.3/Lib/tes
self.assertRaises(OverflowError, os.setregid, 1<<32, 0) self.assertRaises(OverflowError, os.setregid, 1<<32, 0)
self.assertRaises(OverflowError, os.setregid, 0, 1<<32) self.assertRaises(OverflowError, os.setregid, 0, 1<<32)
diff -up Python-3.2.3/Lib/test/test_posix.py.uid-gid-overflows Python-3.2.3/Lib/test/test_posix.py diff -up Python-3.3.0b1/Lib/test/test_posix.py.uid-gid-overflows Python-3.3.0b1/Lib/test/test_posix.py
--- Python-3.2.3/Lib/test/test_posix.py.uid-gid-overflows 2012-04-11 02:54:05.000000000 -0400 --- Python-3.3.0b1/Lib/test/test_posix.py.uid-gid-overflows 2012-06-26 16:19:48.000000000 -0400
+++ Python-3.2.3/Lib/test/test_posix.py 2012-06-18 17:20:18.360775320 -0400 +++ Python-3.3.0b1/Lib/test/test_posix.py 2012-07-20 14:21:46.857688726 -0400
@@ -227,7 +227,7 @@ class PosixTester(unittest.TestCase): @@ -387,10 +387,17 @@ class PosixTester(unittest.TestCase):
else: else:
self.assertTrue(stat.S_ISFIFO(posix.stat(support.TESTFN).st_mode)) self.assertTrue(stat.S_ISFIFO(posix.stat(support.TESTFN).st_mode))
- def _test_all_chown_common(self, chown_func, first_param): - def _test_all_chown_common(self, chown_func, first_param):
+ def _test_all_chown_common(self, chown_func, stat_func, first_param): + def _test_all_chown_common(self, chown_func, stat_func, first_param):
"""Common code for chown, fchown and lchown tests.""" """Common code for chown, fchown and lchown tests."""
if os.getuid() == 0:
try:
@@ -246,6 +246,13 @@ class PosixTester(unittest.TestCase):
first_param, 0, 0)
# test a successful chown call # test a successful chown call
chown_func(first_param, os.getuid(), os.getgid()) chown_func(first_param, os.getuid(), os.getgid())
+ self.assertEqual(stat_func(first_param).st_uid, os.getuid()) + self.assertEqual(stat_func(first_param).st_uid, os.getuid())
@ -100,18 +96,18 @@ diff -up Python-3.2.3/Lib/test/test_posix.py.uid-gid-overflows Python-3.2.3/Lib/
+ self.assertEqual(stat_func(first_param).st_uid, os.getuid()) + self.assertEqual(stat_func(first_param).st_uid, os.getuid())
+ self.assertEqual(stat_func(first_param).st_gid, os.getgid()) + self.assertEqual(stat_func(first_param).st_gid, os.getgid())
@unittest.skipUnless(hasattr(posix, 'chown'), "test needs os.chown()") if os.getuid() == 0:
def test_chown(self): try:
@@ -255,7 +262,7 @@ class PosixTester(unittest.TestCase): @@ -421,7 +428,7 @@ class PosixTester(unittest.TestCase):
# re-create the file # re-create the file
open(support.TESTFN, 'w').close() support.create_empty_file(support.TESTFN)
- self._test_all_chown_common(posix.chown, support.TESTFN) - self._test_all_chown_common(posix.chown, support.TESTFN)
+ self._test_all_chown_common(posix.chown, posix.stat, support.TESTFN) + self._test_all_chown_common(posix.chown, posix.stat, support.TESTFN)
@unittest.skipUnless(hasattr(posix, 'fchown'), "test needs os.fchown()") @unittest.skipUnless(hasattr(posix, 'fchown'), "test needs os.fchown()")
def test_fchown(self): def test_fchown(self):
@@ -265,7 +272,7 @@ class PosixTester(unittest.TestCase): @@ -431,7 +438,7 @@ class PosixTester(unittest.TestCase):
test_file = open(support.TESTFN, 'w') test_file = open(support.TESTFN, 'w')
try: try:
fd = test_file.fileno() fd = test_file.fileno()
@ -120,7 +116,7 @@ diff -up Python-3.2.3/Lib/test/test_posix.py.uid-gid-overflows Python-3.2.3/Lib/
finally: finally:
test_file.close() test_file.close()
@@ -274,7 +281,7 @@ class PosixTester(unittest.TestCase): @@ -440,7 +447,7 @@ class PosixTester(unittest.TestCase):
os.unlink(support.TESTFN) os.unlink(support.TESTFN)
# create a symlink # create a symlink
os.symlink(_DUMMY_SYMLINK, support.TESTFN) os.symlink(_DUMMY_SYMLINK, support.TESTFN)
@ -129,9 +125,9 @@ diff -up Python-3.2.3/Lib/test/test_posix.py.uid-gid-overflows Python-3.2.3/Lib/
def test_chdir(self): def test_chdir(self):
if hasattr(posix, 'chdir'): if hasattr(posix, 'chdir'):
diff -up Python-3.2.3/Lib/test/test_pwd.py.uid-gid-overflows Python-3.2.3/Lib/test/test_pwd.py diff -up Python-3.3.0b1/Lib/test/test_pwd.py.uid-gid-overflows Python-3.3.0b1/Lib/test/test_pwd.py
--- Python-3.2.3/Lib/test/test_pwd.py.uid-gid-overflows 2012-04-11 02:54:05.000000000 -0400 --- Python-3.3.0b1/Lib/test/test_pwd.py.uid-gid-overflows 2012-06-26 16:19:48.000000000 -0400
+++ Python-3.2.3/Lib/test/test_pwd.py 2012-06-18 17:20:18.360775320 -0400 +++ Python-3.3.0b1/Lib/test/test_pwd.py 2012-07-20 14:21:46.857688726 -0400
@@ -87,9 +87,9 @@ class PwdTest(unittest.TestCase): @@ -87,9 +87,9 @@ class PwdTest(unittest.TestCase):
# In some cases, byuids isn't a complete list of all users in the # In some cases, byuids isn't a complete list of all users in the
# system, so if we try to pick a value not in byuids (via a perturbing # system, so if we try to pick a value not in byuids (via a perturbing
@ -144,9 +140,9 @@ diff -up Python-3.2.3/Lib/test/test_pwd.py.uid-gid-overflows Python-3.2.3/Lib/te
self.assertNotIn(fakeuid, byuids) self.assertNotIn(fakeuid, byuids)
self.assertRaises(KeyError, pwd.getpwuid, fakeuid) self.assertRaises(KeyError, pwd.getpwuid, fakeuid)
diff -up Python-3.2.3/Modules/grpmodule.c.uid-gid-overflows Python-3.2.3/Modules/grpmodule.c diff -up Python-3.3.0b1/Modules/grpmodule.c.uid-gid-overflows Python-3.3.0b1/Modules/grpmodule.c
--- Python-3.2.3/Modules/grpmodule.c.uid-gid-overflows 2012-04-11 02:54:07.000000000 -0400 --- Python-3.3.0b1/Modules/grpmodule.c.uid-gid-overflows 2012-06-26 16:19:54.000000000 -0400
+++ Python-3.2.3/Modules/grpmodule.c 2012-06-18 17:20:18.361775307 -0400 +++ Python-3.3.0b1/Modules/grpmodule.c 2012-07-20 14:21:46.858688713 -0400
@@ -69,7 +69,7 @@ mkgrent(struct group *p) @@ -69,7 +69,7 @@ mkgrent(struct group *p)
Py_INCREF(Py_None); Py_INCREF(Py_None);
} }
@ -181,10 +177,10 @@ diff -up Python-3.2.3/Modules/grpmodule.c.uid-gid-overflows Python-3.2.3/Modules
return NULL; return NULL;
} }
return mkgrent(p); return mkgrent(p);
diff -up Python-3.2.3/Modules/posixmodule.c.uid-gid-overflows Python-3.2.3/Modules/posixmodule.c diff -up Python-3.3.0b1/Modules/posixmodule.c.uid-gid-overflows Python-3.3.0b1/Modules/posixmodule.c
--- Python-3.2.3/Modules/posixmodule.c.uid-gid-overflows 2012-06-18 17:20:18.258776596 -0400 --- Python-3.3.0b1/Modules/posixmodule.c.uid-gid-overflows 2012-07-20 14:21:46.788689588 -0400
+++ Python-3.2.3/Modules/posixmodule.c 2012-06-18 17:20:18.362775294 -0400 +++ Python-3.3.0b1/Modules/posixmodule.c 2012-07-20 14:24:19.626778849 -0400
@@ -1642,8 +1642,8 @@ _pystat_fromstructstat(STRUCT_STAT *st) @@ -2151,8 +2151,8 @@ _pystat_fromstructstat(STRUCT_STAT *st)
PyStructSequence_SET_ITEM(v, 2, PyLong_FromLong((long)st->st_dev)); PyStructSequence_SET_ITEM(v, 2, PyLong_FromLong((long)st->st_dev));
#endif #endif
PyStructSequence_SET_ITEM(v, 3, PyLong_FromLong((long)st->st_nlink)); PyStructSequence_SET_ITEM(v, 3, PyLong_FromLong((long)st->st_nlink));
@ -195,29 +191,37 @@ diff -up Python-3.2.3/Modules/posixmodule.c.uid-gid-overflows Python-3.2.3/Modul
#ifdef HAVE_LARGEFILE_SUPPORT #ifdef HAVE_LARGEFILE_SUPPORT
PyStructSequence_SET_ITEM(v, 6, PyStructSequence_SET_ITEM(v, 6,
PyLong_FromLongLong((PY_LONG_LONG)st->st_size)); PyLong_FromLongLong((PY_LONG_LONG)st->st_size));
@@ -2172,15 +2172,17 @@ posix_chown(PyObject *self, PyObject *ar @@ -2957,7 +2957,6 @@ static PyObject *
posix_chown(PyObject *self, PyObject *args, PyObject *kwargs)
{ {
PyObject *opath; path_t path;
char *path; - long uid_l, gid_l;
- long uid, gid; uid_t uid;
+ uid_t uid; gid_t gid;
+ gid_t gid; int dir_fd = DEFAULT_DIR_FD;
int res; @@ -2971,9 +2970,10 @@ posix_chown(PyObject *self, PyObject *ar
- if (!PyArg_ParseTuple(args, "O&ll:chown", #ifdef HAVE_FCHOWN
+ if (!PyArg_ParseTuple(args, "O&O&O&:chown", path.allow_fd = 1;
PyUnicode_FSConverter, &opath, #endif
- &uid, &gid)) - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O&ll|$O&p:chown", keywords,
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O&O&O&|$O&p:chown", keywords,
path_converter, &path,
- &uid_l, &gid_l,
+ _PyArg_ParseUid, &uid, + _PyArg_ParseUid, &uid,
+ _PyArg_ParseGid, &gid)) + _PyArg_ParseGid, &gid,
return NULL; #ifdef HAVE_FCHOWNAT
path = PyBytes_AsString(opath); dir_fd_converter, &dir_fd,
#else
@@ -3004,8 +3004,6 @@ posix_chown(PyObject *self, PyObject *ar
#endif
Py_BEGIN_ALLOW_THREADS Py_BEGIN_ALLOW_THREADS
- res = chown(path, (uid_t) uid, (gid_t) gid); - uid = (uid_t)uid_l;
+ res = chown(path, uid, gid); - gid = (uid_t)gid_l;
Py_END_ALLOW_THREADS #ifdef HAVE_FCHOWN
if (res < 0) if (path.fd != -1)
return posix_error_with_allocated_filename(opath); result = fchown(path.fd, uid, gid);
@@ -2200,12 +2202,15 @@ static PyObject * @@ -3049,12 +3047,15 @@ static PyObject *
posix_fchown(PyObject *self, PyObject *args) posix_fchown(PyObject *self, PyObject *args)
{ {
int fd; int fd;
@ -236,7 +240,7 @@ diff -up Python-3.2.3/Modules/posixmodule.c.uid-gid-overflows Python-3.2.3/Modul
Py_END_ALLOW_THREADS Py_END_ALLOW_THREADS
if (res < 0) if (res < 0)
return posix_error(); return posix_error();
@@ -2224,15 +2229,17 @@ posix_lchown(PyObject *self, PyObject *a @@ -3074,15 +3075,17 @@ posix_lchown(PyObject *self, PyObject *a
{ {
PyObject *opath; PyObject *opath;
char *path; char *path;
@ -258,7 +262,7 @@ diff -up Python-3.2.3/Modules/posixmodule.c.uid-gid-overflows Python-3.2.3/Modul
Py_END_ALLOW_THREADS Py_END_ALLOW_THREADS
if (res < 0) if (res < 0)
return posix_error_with_allocated_filename(opath); return posix_error_with_allocated_filename(opath);
@@ -4287,7 +4294,7 @@ Return the current process's effective g @@ -6184,7 +6187,7 @@ Return the current process's effective g
static PyObject * static PyObject *
posix_getegid(PyObject *self, PyObject *noargs) posix_getegid(PyObject *self, PyObject *noargs)
{ {
@ -267,7 +271,7 @@ diff -up Python-3.2.3/Modules/posixmodule.c.uid-gid-overflows Python-3.2.3/Modul
} }
#endif #endif
@@ -4300,7 +4307,7 @@ Return the current process's effective u @@ -6197,7 +6200,7 @@ Return the current process's effective u
static PyObject * static PyObject *
posix_geteuid(PyObject *self, PyObject *noargs) posix_geteuid(PyObject *self, PyObject *noargs)
{ {
@ -276,7 +280,7 @@ diff -up Python-3.2.3/Modules/posixmodule.c.uid-gid-overflows Python-3.2.3/Modul
} }
#endif #endif
@@ -4313,7 +4320,7 @@ Return the current process's group id.") @@ -6210,7 +6213,7 @@ Return the current process's group id.")
static PyObject * static PyObject *
posix_getgid(PyObject *self, PyObject *noargs) posix_getgid(PyObject *self, PyObject *noargs)
{ {
@ -285,7 +289,7 @@ diff -up Python-3.2.3/Modules/posixmodule.c.uid-gid-overflows Python-3.2.3/Modul
} }
#endif #endif
@@ -4388,7 +4395,7 @@ posix_getgroups(PyObject *self, PyObject @@ -6349,7 +6352,7 @@ posix_getgroups(PyObject *self, PyObject
if (result != NULL) { if (result != NULL) {
int i; int i;
for (i = 0; i < n; ++i) { for (i = 0; i < n; ++i) {
@ -294,7 +298,7 @@ diff -up Python-3.2.3/Modules/posixmodule.c.uid-gid-overflows Python-3.2.3/Modul
if (o == NULL) { if (o == NULL) {
Py_DECREF(result); Py_DECREF(result);
result = NULL; result = NULL;
@@ -4419,14 +4426,15 @@ posix_initgroups(PyObject *self, PyObjec @@ -6380,14 +6383,15 @@ posix_initgroups(PyObject *self, PyObjec
PyObject *oname; PyObject *oname;
char *username; char *username;
int res; int res;
@ -314,7 +318,7 @@ diff -up Python-3.2.3/Modules/posixmodule.c.uid-gid-overflows Python-3.2.3/Modul
Py_DECREF(oname); Py_DECREF(oname);
if (res == -1) if (res == -1)
return PyErr_SetFromErrno(PyExc_OSError); return PyErr_SetFromErrno(PyExc_OSError);
@@ -4601,7 +4609,7 @@ Return the current process's user id."); @@ -6562,7 +6566,7 @@ Return the current process's user id.");
static PyObject * static PyObject *
posix_getuid(PyObject *self, PyObject *noargs) posix_getuid(PyObject *self, PyObject *noargs)
{ {
@ -323,7 +327,7 @@ diff -up Python-3.2.3/Modules/posixmodule.c.uid-gid-overflows Python-3.2.3/Modul
} }
#endif #endif
@@ -4741,15 +4749,9 @@ Set the current process's user id."); @@ -6702,15 +6706,9 @@ Set the current process's user id.");
static PyObject * static PyObject *
posix_setuid(PyObject *self, PyObject *args) posix_setuid(PyObject *self, PyObject *args)
{ {
@ -340,24 +344,24 @@ diff -up Python-3.2.3/Modules/posixmodule.c.uid-gid-overflows Python-3.2.3/Modul
if (setuid(uid) < 0) if (setuid(uid) < 0)
return posix_error(); return posix_error();
Py_INCREF(Py_None); Py_INCREF(Py_None);
@@ -4766,15 +4768,9 @@ Set the current process's effective user @@ -6727,15 +6725,9 @@ Set the current process's effective user
static PyObject * static PyObject *
posix_seteuid (PyObject *self, PyObject *args) posix_seteuid (PyObject *self, PyObject *args)
{ {
- long euid_arg; - long euid_arg;
uid_t euid; uid_t euid;
- if (!PyArg_ParseTuple(args, "l", &euid_arg)) - if (!PyArg_ParseTuple(args, "l", &euid_arg))
- return NULL; + if (!PyArg_ParseTuple(args, "O&:seteuid", _PyArg_ParseUid, &euid))
return NULL;
- euid = euid_arg; - euid = euid_arg;
- if (euid != euid_arg) { - if (euid != euid_arg) {
- PyErr_SetString(PyExc_OverflowError, "user id too big"); - PyErr_SetString(PyExc_OverflowError, "user id too big");
+ if (!PyArg_ParseTuple(args, "O&:seteuid", _PyArg_ParseUid, &euid)) - return NULL;
return NULL;
- } - }
if (seteuid(euid) < 0) { if (seteuid(euid) < 0) {
return posix_error(); return posix_error();
} else { } else {
@@ -4792,15 +4788,9 @@ Set the current process's effective grou @@ -6753,15 +6745,9 @@ Set the current process's effective grou
static PyObject * static PyObject *
posix_setegid (PyObject *self, PyObject *args) posix_setegid (PyObject *self, PyObject *args)
{ {
@ -374,7 +378,7 @@ diff -up Python-3.2.3/Modules/posixmodule.c.uid-gid-overflows Python-3.2.3/Modul
if (setegid(egid) < 0) { if (setegid(egid) < 0) {
return posix_error(); return posix_error();
} else { } else {
@@ -4818,23 +4808,11 @@ Set the current process's real and effec @@ -6779,23 +6765,11 @@ Set the current process's real and effec
static PyObject * static PyObject *
posix_setreuid (PyObject *self, PyObject *args) posix_setreuid (PyObject *self, PyObject *args)
{ {
@ -401,7 +405,7 @@ diff -up Python-3.2.3/Modules/posixmodule.c.uid-gid-overflows Python-3.2.3/Modul
if (setreuid(ruid, euid) < 0) { if (setreuid(ruid, euid) < 0) {
return posix_error(); return posix_error();
} else { } else {
@@ -4852,23 +4830,11 @@ Set the current process's real and effec @@ -6813,23 +6787,11 @@ Set the current process's real and effec
static PyObject * static PyObject *
posix_setregid (PyObject *self, PyObject *args) posix_setregid (PyObject *self, PyObject *args)
{ {
@ -428,7 +432,7 @@ diff -up Python-3.2.3/Modules/posixmodule.c.uid-gid-overflows Python-3.2.3/Modul
if (setregid(rgid, egid) < 0) { if (setregid(rgid, egid) < 0) {
return posix_error(); return posix_error();
} else { } else {
@@ -4886,15 +4852,9 @@ Set the current process's group id."); @@ -6847,15 +6809,9 @@ Set the current process's group id.");
static PyObject * static PyObject *
posix_setgid(PyObject *self, PyObject *args) posix_setgid(PyObject *self, PyObject *args)
{ {
@ -445,7 +449,7 @@ diff -up Python-3.2.3/Modules/posixmodule.c.uid-gid-overflows Python-3.2.3/Modul
if (setgid(gid) < 0) if (setgid(gid) < 0)
return posix_error(); return posix_error();
Py_INCREF(Py_None); Py_INCREF(Py_None);
@@ -4927,27 +4887,9 @@ posix_setgroups(PyObject *self, PyObject @@ -6888,27 +6844,9 @@ posix_setgroups(PyObject *self, PyObject
elem = PySequence_GetItem(groups, i); elem = PySequence_GetItem(groups, i);
if (!elem) if (!elem)
return NULL; return NULL;
@ -474,7 +478,7 @@ diff -up Python-3.2.3/Modules/posixmodule.c.uid-gid-overflows Python-3.2.3/Modul
} }
Py_DECREF(elem); Py_DECREF(elem);
} }
@@ -7689,9 +7631,11 @@ Set the current process's real, effectiv @@ -10388,9 +10326,11 @@ Set the current process's real, effectiv
static PyObject* static PyObject*
posix_setresuid (PyObject *self, PyObject *args) posix_setresuid (PyObject *self, PyObject *args)
{ {
@ -489,7 +493,7 @@ diff -up Python-3.2.3/Modules/posixmodule.c.uid-gid-overflows Python-3.2.3/Modul
return NULL; return NULL;
if (setresuid(ruid, euid, suid) < 0) if (setresuid(ruid, euid, suid) < 0)
return posix_error(); return posix_error();
@@ -7707,9 +7651,11 @@ Set the current process's real, effectiv @@ -10406,9 +10346,11 @@ Set the current process's real, effectiv
static PyObject* static PyObject*
posix_setresgid (PyObject *self, PyObject *args) posix_setresgid (PyObject *self, PyObject *args)
{ {
@ -504,7 +508,7 @@ diff -up Python-3.2.3/Modules/posixmodule.c.uid-gid-overflows Python-3.2.3/Modul
return NULL; return NULL;
if (setresgid(rgid, egid, sgid) < 0) if (setresgid(rgid, egid, sgid) < 0)
return posix_error(); return posix_error();
@@ -7726,14 +7672,13 @@ static PyObject* @@ -10425,14 +10367,13 @@ static PyObject*
posix_getresuid (PyObject *self, PyObject *noargs) posix_getresuid (PyObject *self, PyObject *noargs)
{ {
uid_t ruid, euid, suid; uid_t ruid, euid, suid;
@ -524,7 +528,7 @@ diff -up Python-3.2.3/Modules/posixmodule.c.uid-gid-overflows Python-3.2.3/Modul
} }
#endif #endif
@@ -7746,14 +7691,13 @@ static PyObject* @@ -10445,14 +10386,13 @@ static PyObject*
posix_getresgid (PyObject *self, PyObject *noargs) posix_getresgid (PyObject *self, PyObject *noargs)
{ {
uid_t rgid, egid, sgid; uid_t rgid, egid, sgid;
@ -544,9 +548,9 @@ diff -up Python-3.2.3/Modules/posixmodule.c.uid-gid-overflows Python-3.2.3/Modul
} }
#endif #endif
diff -up Python-3.2.3/Modules/pwdmodule.c.uid-gid-overflows Python-3.2.3/Modules/pwdmodule.c diff -up Python-3.3.0b1/Modules/pwdmodule.c.uid-gid-overflows Python-3.3.0b1/Modules/pwdmodule.c
--- Python-3.2.3/Modules/pwdmodule.c.uid-gid-overflows 2012-04-11 02:54:07.000000000 -0400 --- Python-3.3.0b1/Modules/pwdmodule.c.uid-gid-overflows 2012-06-26 16:19:54.000000000 -0400
+++ Python-3.2.3/Modules/pwdmodule.c 2012-06-18 17:20:18.362775294 -0400 +++ Python-3.3.0b1/Modules/pwdmodule.c 2012-07-20 14:21:46.861688675 -0400
@@ -74,8 +74,8 @@ mkpwent(struct passwd *p) @@ -74,8 +74,8 @@ mkpwent(struct passwd *p)
#else #else
SETS(setIndex++, p->pw_passwd); SETS(setIndex++, p->pw_passwd);
@ -576,9 +580,9 @@ diff -up Python-3.2.3/Modules/pwdmodule.c.uid-gid-overflows Python-3.2.3/Modules
return NULL; return NULL;
} }
return mkpwent(p); return mkpwent(p);
diff -up Python-3.2.3/Python/getargs.c.uid-gid-overflows Python-3.2.3/Python/getargs.c diff -up Python-3.3.0b1/Python/getargs.c.uid-gid-overflows Python-3.3.0b1/Python/getargs.c
--- Python-3.2.3/Python/getargs.c.uid-gid-overflows 2012-04-11 02:54:08.000000000 -0400 --- Python-3.3.0b1/Python/getargs.c.uid-gid-overflows 2012-06-26 16:19:57.000000000 -0400
+++ Python-3.2.3/Python/getargs.c 2012-06-18 17:20:18.363775282 -0400 +++ Python-3.3.0b1/Python/getargs.c 2012-07-20 14:21:46.861688675 -0400
@@ -4,6 +4,7 @@ @@ -4,6 +4,7 @@
#include "Python.h" #include "Python.h"
@ -587,7 +591,7 @@ diff -up Python-3.2.3/Python/getargs.c.uid-gid-overflows Python-3.2.3/Python/get
#ifdef __cplusplus #ifdef __cplusplus
@@ -1789,6 +1790,102 @@ _PyArg_NoKeywords(const char *funcname, @@ -1807,6 +1808,102 @@ _PyArg_NoKeywords(const char *funcname,
funcname); funcname);
return 0; return 0;
} }

View File

@ -0,0 +1,11 @@
diff -up Python-3.3.0b1/Lib/test/test_posix.py.disable-test_fs_holes-in-rpm-build.patch Python-3.3.0b1/Lib/test/test_posix.py
--- Python-3.3.0b1/Lib/test/test_posix.py.disable-test_fs_holes-in-rpm-build.patch 2012-07-23 13:53:11.636847977 -0400
+++ Python-3.3.0b1/Lib/test/test_posix.py 2012-07-23 13:54:02.810208218 -0400
@@ -1022,6 +1022,7 @@ class PosixTester(unittest.TestCase):
posix.RTLD_GLOBAL
posix.RTLD_LOCAL
+ @unittest._skipInRpmBuild('running kernel may not match kernel in chroot')
@unittest.skipUnless(hasattr(os, 'SEEK_HOLE'),
"test needs an OS that reports file holes")
@unittest.skipIf(sys.platform in ('freebsd7', 'freebsd8', 'freebsd9'),

View File

@ -0,0 +1,12 @@
diff -up Python-3.3.0b1/Lib/test/test_tools.py.fix-test_tools-directory Python-3.3.0b1/Lib/test/test_tools.py
--- Python-3.3.0b1/Lib/test/test_tools.py.fix-test_tools-directory 2012-07-23 15:08:19.271494787 -0400
+++ Python-3.3.0b1/Lib/test/test_tools.py 2012-07-23 15:08:32.183333368 -0400
@@ -19,7 +19,7 @@ if not sysconfig.is_python_build():
# and run the tests in that case too?
raise unittest.SkipTest('test irrelevant for an installed Python')
-srcdir = sysconfig.get_config_var('projectbase')
+srcdir = sysconfig.get_config_var('srcdir')
basepath = os.path.join(os.getcwd(), srcdir, 'Tools')
scriptsdir = os.path.join(basepath, 'scripts')

View File

@ -0,0 +1,14 @@
diff -up Python-3.3.0b1/Lib/distutils/sysconfig.py.fix-CC-options.patch Python-3.3.0b1/Lib/distutils/sysconfig.py
--- Python-3.3.0b1/Lib/distutils/sysconfig.py.fix-CC-options.patch 2012-07-24 11:57:43.804353959 -0400
+++ Python-3.3.0b1/Lib/distutils/sysconfig.py 2012-07-24 11:59:38.341354843 -0400
@@ -580,7 +580,9 @@ def get_config_vars(*args):
# skip checks if the compiler was overriden with a CC env variable
if 'CC' not in os.environ:
cc = oldcc = _config_vars['CC']
- if not find_executable(cc):
+ # CC might contain additional arguments e.g. "gcc -pthread", so
+ # look for the first word:
+ if not find_executable(cc.split()[0]):
# Compiler is not found on the shell search PATH.
# Now search for clang, first on PATH (if the Command LIne
# Tools have been installed in / or if the user has provided

View File

@ -0,0 +1,11 @@
diff -up Python-3.3.0b1/Lib/test/test_socket.py.disable-test_socket-in-rpm-builds Python-3.3.0b1/Lib/test/test_socket.py
--- Python-3.3.0b1/Lib/test/test_socket.py.disable-test_socket-in-rpm-builds 2012-07-24 15:02:30.823355067 -0400
+++ Python-3.3.0b1/Lib/test/test_socket.py 2012-07-24 15:08:13.021354999 -0400
@@ -2188,6 +2188,7 @@ class RecvmsgGenericStreamTests(RecvmsgG
# Tests which require a stream socket and can use either recvmsg()
# or recvmsg_into().
+ @unittest._skipInRpmBuild('fails intermittently when run within Koji')
def testRecvmsgEOF(self):
# Receive end-of-stream indicator (b"", peer socket closed).
msg, ancdata, flags, addr = self.doRecvmsg(self.serv_sock, 1024)

View File

@ -1,16 +1,184 @@
diff -up ./configure.autotool-intermediates ./configure diff -up ./configure.autotool-intermediates ./configure
--- ./configure.autotool-intermediates 2011-07-11 11:50:06.910425999 -0400 --- ./configure.autotool-intermediates 2012-07-20 14:09:54.811590526 -0400
+++ ./configure 2011-07-11 11:50:13.492426001 -0400 +++ ./configure 2012-07-20 14:10:00.525519093 -0400
@@ -619,6 +619,8 @@ TRUE @@ -1,11 +1,13 @@
MACHDEP_OBJS #! /bin/sh
DYNLOADFILE # Guess values for system-dependent variables and create Makefiles.
DLINCLDIR -# Generated by GNU Autoconf 2.69 for python 3.3.
+DTRACEHDRS +# Generated by GNU Autoconf 2.68 for python 3.3.
+DTRACEOBJS #
THREADOBJ # Report bugs to <http://bugs.python.org/>.
LDLAST #
USE_THREAD_MODULE #
@@ -764,8 +766,11 @@ with_thread -# Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc.
+# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
+# 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software
+# Foundation, Inc.
#
#
# This configure script is free software; the Free Software Foundation
@@ -134,31 +136,6 @@ export LANGUAGE
# CDPATH.
(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
-# Use a proper internal environment variable to ensure we don't fall
- # into an infinite loop, continuously re-executing ourselves.
- if test x"${_as_can_reexec}" != xno && test "x$CONFIG_SHELL" != x; then
- _as_can_reexec=no; export _as_can_reexec;
- # We cannot yet assume a decent shell, so we have to provide a
-# neutralization value for shells without unset; and this also
-# works around shells that cannot unset nonexistent variables.
-# Preserve -v and -x to the replacement shell.
-BASH_ENV=/dev/null
-ENV=/dev/null
-(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV
-case $- in # ((((
- *v*x* | *x*v* ) as_opts=-vx ;;
- *v* ) as_opts=-v ;;
- *x* ) as_opts=-x ;;
- * ) as_opts= ;;
-esac
-exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"}
-# Admittedly, this is quite paranoid, since all the known shells bail
-# out after a failed `exec'.
-$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2
-as_fn_exit 255
- fi
- # We don't want this to propagate to other subprocesses.
- { _as_can_reexec=; unset _as_can_reexec;}
if test "x$CONFIG_SHELL" = x; then
as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then :
emulate sh
@@ -192,8 +169,7 @@ if ( set x; as_fn_ret_success y && test
else
exitcode=1; echo positional parameters were not saved.
fi
-test x\$exitcode = x0 || exit 1
-test -x / || exit 1"
+test x\$exitcode = x0 || exit 1"
as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO
as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO
eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" &&
@@ -238,25 +214,21 @@ IFS=$as_save_IFS
if test "x$CONFIG_SHELL" != x; then :
- export CONFIG_SHELL
- # We cannot yet assume a decent shell, so we have to provide a
-# neutralization value for shells without unset; and this also
-# works around shells that cannot unset nonexistent variables.
-# Preserve -v and -x to the replacement shell.
-BASH_ENV=/dev/null
-ENV=/dev/null
-(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV
-case $- in # ((((
- *v*x* | *x*v* ) as_opts=-vx ;;
- *v* ) as_opts=-v ;;
- *x* ) as_opts=-x ;;
- * ) as_opts= ;;
-esac
-exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"}
-# Admittedly, this is quite paranoid, since all the known shells bail
-# out after a failed `exec'.
-$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2
-exit 255
+ # We cannot yet assume a decent shell, so we have to provide a
+ # neutralization value for shells without unset; and this also
+ # works around shells that cannot unset nonexistent variables.
+ # Preserve -v and -x to the replacement shell.
+ BASH_ENV=/dev/null
+ ENV=/dev/null
+ (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV
+ export CONFIG_SHELL
+ case $- in # ((((
+ *v*x* | *x*v* ) as_opts=-vx ;;
+ *v* ) as_opts=-v ;;
+ *x* ) as_opts=-x ;;
+ * ) as_opts= ;;
+ esac
+ exec "$CONFIG_SHELL" $as_opts "$as_myself" ${1+"$@"}
fi
if test x$as_have_required = xno; then :
@@ -359,14 +331,6 @@ $as_echo X"$as_dir" |
} # as_fn_mkdir_p
-
-# as_fn_executable_p FILE
-# -----------------------
-# Test if FILE is an executable regular file.
-as_fn_executable_p ()
-{
- test -f "$1" && test -x "$1"
-} # as_fn_executable_p
# as_fn_append VAR VALUE
# ----------------------
# Append the text in VALUE to the end of the definition contained in VAR. Take
@@ -488,10 +452,6 @@ as_cr_alnum=$as_cr_Letters$as_cr_digits
chmod +x "$as_me.lineno" ||
{ $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; }
- # If we had to re-execute with $CONFIG_SHELL, we're ensured to have
- # already done that, so ensure we don't try to do so again and fall
- # in an infinite loop. This has already happened in practice.
- _as_can_reexec=no; export _as_can_reexec
# Don't try to exec as it changes $[0], causing all sort of problems
# (the dirname of $[0] is not the place where we might find the
# original and so on. Autoconf is especially sensitive to this).
@@ -526,16 +486,16 @@ if (echo >conf$$.file) 2>/dev/null; then
# ... but there are two gotchas:
# 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
# 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
- # In both cases, we have to default to `cp -pR'.
+ # In both cases, we have to default to `cp -p'.
ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
- as_ln_s='cp -pR'
+ as_ln_s='cp -p'
elif ln conf$$.file conf$$ 2>/dev/null; then
as_ln_s=ln
else
- as_ln_s='cp -pR'
+ as_ln_s='cp -p'
fi
else
- as_ln_s='cp -pR'
+ as_ln_s='cp -p'
fi
rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
rmdir conf$$.dir 2>/dev/null
@@ -547,8 +507,28 @@ else
as_mkdir_p=false
fi
-as_test_x='test -x'
-as_executable_p=as_fn_executable_p
+if test -x / >/dev/null 2>&1; then
+ as_test_x='test -x'
+else
+ if ls -dL / >/dev/null 2>&1; then
+ as_ls_L_option=L
+ else
+ as_ls_L_option=
+ fi
+ as_test_x='
+ eval sh -c '\''
+ if test -d "$1"; then
+ test -d "$1/.";
+ else
+ case $1 in #(
+ -*)set "./$1";;
+ esac;
+ case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #((
+ ???[sx]*):;;*)false;;esac;fi
+ '\'' sh
+ '
+fi
+as_executable_p=$as_test_x
# Sed expression to map a string onto a valid CPP name.
as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
@@ -793,6 +773,8 @@ with_thread
enable_ipv6 enable_ipv6
with_doc_strings with_doc_strings
with_tsc with_tsc
@ -18,21 +186,17 @@ diff -up ./configure.autotool-intermediates ./configure
+with_call_profile +with_call_profile
with_pymalloc with_pymalloc
with_valgrind with_valgrind
+with_dtrace with_systemtap
with_fpectl @@ -1266,6 +1248,8 @@ target=$target_alias
with_libm if test "x$host_alias" != x; then
with_libc if test "x$build_alias" = x; then
@@ -781,7 +786,8 @@ CFLAGS cross_compiling=maybe
LDFLAGS + $as_echo "$as_me: WARNING: if you wanted to set the --build type, don't use --host.
LIBS + If a cross compiler is detected then cross compile mode will be used" >&2
CPPFLAGS elif test "x$build_alias" != "x$host_alias"; then
-CPP' cross_compiling=yes
+CPP fi
+CPPFLAGS' @@ -1469,6 +1453,8 @@ Optional Packages:
# Initialize some variables set by options.
@@ -1437,8 +1443,11 @@ Optional Packages:
deprecated; use --with(out)-threads deprecated; use --with(out)-threads
--with(out)-doc-strings disable/enable documentation strings --with(out)-doc-strings disable/enable documentation strings
--with(out)-tsc enable/disable timestamp counter profile --with(out)-tsc enable/disable timestamp counter profile
@ -40,11 +204,328 @@ diff -up ./configure.autotool-intermediates ./configure
+ --with(out)-call-profile enable/disable statistics on function call invocation + --with(out)-call-profile enable/disable statistics on function call invocation
--with(out)-pymalloc disable/enable specialized mallocs --with(out)-pymalloc disable/enable specialized mallocs
--with-valgrind Enable Valgrind support --with-valgrind Enable Valgrind support
+ --with(out)-dtrace disable/enable dtrace support --with(out)-systemtap disable/enable SystemTap support
--with-fpectl enable SIGFPE catching @@ -1556,9 +1542,9 @@ test -n "$ac_init_help" && exit $ac_stat
--with-libm=STRING math library if $ac_init_version; then
--with-libc=STRING C library cat <<\_ACEOF
@@ -9284,6 +9293,50 @@ $as_echo "no" >&6; } python configure 3.3
-generated by GNU Autoconf 2.69
+generated by GNU Autoconf 2.68
-Copyright (C) 2012 Free Software Foundation, Inc.
+Copyright (C) 2010 Free Software Foundation, Inc.
This configure script is free software; the Free Software Foundation
gives unlimited permission to copy, distribute and modify it.
_ACEOF
@@ -1634,7 +1620,7 @@ $as_echo "$ac_try_echo"; } >&5
test ! -s conftest.err
} && test -s conftest$ac_exeext && {
test "$cross_compiling" = yes ||
- test -x conftest$ac_exeext
+ $as_test_x conftest$ac_exeext
}; then :
ac_retval=0
else
@@ -1932,8 +1918,7 @@ int
main ()
{
static int test_array [1 - 2 * !((($ac_type) -1 >> ($2 / 2 - 1)) >> ($2 / 2 - 1) == 3)];
-test_array [0] = 0;
-return test_array [0];
+test_array [0] = 0
;
return 0;
@@ -1987,8 +1972,7 @@ int
main ()
{
static int test_array [1 - 2 * !(0 < ($ac_type) ((((($ac_type) 1 << N) << N) - 1) * 2 + 1))];
-test_array [0] = 0;
-return test_array [0];
+test_array [0] = 0
;
return 0;
@@ -2004,8 +1988,7 @@ main ()
{
static int test_array [1 - 2 * !(($ac_type) ((((($ac_type) 1 << N) << N) - 1) * 2 + 1)
< ($ac_type) ((((($ac_type) 1 << N) << N) - 1) * 2 + 2))];
-test_array [0] = 0;
-return test_array [0];
+test_array [0] = 0
;
return 0;
@@ -2055,8 +2038,7 @@ int
main ()
{
static int test_array [1 - 2 * !(($2) >= 0)];
-test_array [0] = 0;
-return test_array [0];
+test_array [0] = 0
;
return 0;
@@ -2072,8 +2054,7 @@ int
main ()
{
static int test_array [1 - 2 * !(($2) <= $ac_mid)];
-test_array [0] = 0;
-return test_array [0];
+test_array [0] = 0
;
return 0;
@@ -2099,8 +2080,7 @@ int
main ()
{
static int test_array [1 - 2 * !(($2) < 0)];
-test_array [0] = 0;
-return test_array [0];
+test_array [0] = 0
;
return 0;
@@ -2116,8 +2096,7 @@ int
main ()
{
static int test_array [1 - 2 * !(($2) >= $ac_mid)];
-test_array [0] = 0;
-return test_array [0];
+test_array [0] = 0
;
return 0;
@@ -2151,8 +2130,7 @@ int
main ()
{
static int test_array [1 - 2 * !(($2) <= $ac_mid)];
-test_array [0] = 0;
-return test_array [0];
+test_array [0] = 0
;
return 0;
@@ -2395,7 +2373,7 @@ This file contains any messages produced
running configure, to aid debugging if configure makes a mistake.
It was created by python $as_me 3.3, which was
-generated by GNU Autoconf 2.69. Invocation command line was
+generated by GNU Autoconf 2.68. Invocation command line was
$ $0 $@
@@ -2765,7 +2743,7 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
ac_cv_prog_HAS_HG="found"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
@@ -3508,7 +3486,7 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
ac_cv_prog_CC="${ac_tool_prefix}gcc"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
@@ -3548,7 +3526,7 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
ac_cv_prog_ac_ct_CC="gcc"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
@@ -3601,7 +3579,7 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
ac_cv_prog_CC="${ac_tool_prefix}cc"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
@@ -3642,7 +3620,7 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then
ac_prog_rejected=yes
continue
@@ -3700,7 +3678,7 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
ac_cv_prog_CC="$ac_tool_prefix$ac_prog"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
@@ -3744,7 +3722,7 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
ac_cv_prog_ac_ct_CC="$ac_prog"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
@@ -4190,7 +4168,8 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_
/* end confdefs.h. */
#include <stdarg.h>
#include <stdio.h>
-struct stat;
+#include <sys/types.h>
+#include <sys/stat.h>
/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */
struct buf { int x; };
FILE * (*rcsopen) (struct buf *, struct stat *, int);
@@ -4329,7 +4308,7 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
ac_cv_path_CXX="$as_dir/$ac_word$ac_exec_ext"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
@@ -4370,7 +4349,7 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
ac_cv_path_CXX="$as_dir/$ac_word$ac_exec_ext"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
@@ -4411,7 +4390,7 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
ac_cv_path_CXX="$as_dir/$ac_word$ac_exec_ext"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
@@ -4460,7 +4439,7 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
ac_cv_prog_CXX="$ac_prog"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
@@ -4691,7 +4670,7 @@ do
for ac_prog in grep ggrep; do
for ac_exec_ext in '' $ac_executable_extensions; do
ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext"
- as_fn_executable_p "$ac_path_GREP" || continue
+ { test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue
# Check for GNU ac_path_GREP and select it if it is found.
# Check for GNU $ac_path_GREP
case `"$ac_path_GREP" --version 2>&1` in
@@ -4757,7 +4736,7 @@ do
for ac_prog in egrep; do
for ac_exec_ext in '' $ac_executable_extensions; do
ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext"
- as_fn_executable_p "$ac_path_EGREP" || continue
+ { test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue
# Check for GNU ac_path_EGREP and select it if it is found.
# Check for GNU $ac_path_EGREP
case `"$ac_path_EGREP" --version 2>&1` in
@@ -4964,8 +4943,8 @@ else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
-# define __EXTENSIONS__ 1
- $ac_includes_default
+# define __EXTENSIONS__ 1
+ $ac_includes_default
int
main ()
{
@@ -5359,7 +5338,7 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
@@ -5399,7 +5378,7 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
ac_cv_prog_ac_ct_RANLIB="ranlib"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
@@ -5453,7 +5432,7 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
ac_cv_prog_AR="$ac_prog"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
@@ -5504,7 +5483,7 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
ac_cv_prog_HAS_PYTHON="found"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
@@ -5577,7 +5556,7 @@ case $as_dir/ in #((
# by default.
for ac_prog in ginstall scoinst install; do
for ac_exec_ext in '' $ac_executable_extensions; do
- if as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then
+ if { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; }; then
if test $ac_prog = install &&
grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
# AIX install. It has an incompatible calling convention.
@@ -5646,7 +5625,7 @@ do
test -z "$as_dir" && as_dir=.
for ac_prog in mkdir gmkdir; do
for ac_exec_ext in '' $ac_executable_extensions; do
- as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext" || continue
+ { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; } || continue
case `"$as_dir/$ac_prog$ac_exec_ext" --version 2>&1` in #(
'mkdir (GNU coreutils) '* | \
'mkdir (coreutils) '* | \
@@ -8538,7 +8517,7 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
@@ -8581,7 +8560,7 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
ac_cv_path_ac_pt_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
@@ -9591,6 +9570,50 @@ $as_echo "no" >&6; }
fi fi
@ -95,72 +576,155 @@ diff -up ./configure.autotool-intermediates ./configure
# Check for Python-specific malloc support # Check for Python-specific malloc support
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for --with-pymalloc" >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for --with-pymalloc" >&5
$as_echo_n "checking for --with-pymalloc... " >&6; } $as_echo_n "checking for --with-pymalloc... " >&6; }
@@ -9336,6 +9389,46 @@ fi @@ -10208,7 +10231,7 @@ do
OPT="-DDYNAMIC_ANNOTATIONS_ENABLED=1 $OPT" IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
ac_cv_prog_TRUE="$ac_prog"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
@@ -11645,8 +11668,7 @@ int
main ()
{
static int test_array [1 - 2 * !(((char) -1) < 0)];
-test_array [0] = 0;
-return test_array [0];
+test_array [0] = 0
;
return 0;
@@ -11677,11 +11699,11 @@ else
int
main ()
{
-
+/* FIXME: Include the comments suggested by Paul. */
#ifndef __cplusplus
- /* Ultrix mips cc rejects this sort of thing. */
+ /* Ultrix mips cc rejects this. */
typedef int charset[2];
- const charset cs = { 0, 0 };
+ const charset cs;
/* SunOS 4.1.1 cc rejects this. */
char const *const *pcpcc;
char **ppc;
@@ -11698,9 +11720,8 @@ main ()
++pcpcc;
ppc = (char**) pcpcc;
pcpcc = (char const *const *) ppc;
- { /* SCO 3.2v4 cc rejects this sort of thing. */
- char tx;
- char *t = &tx;
+ { /* SCO 3.2v4 cc rejects this. */
+ char *t;
char const *s = 0 ? (char *) 0 : (char const *) 0;
*t++ = 0;
@@ -11716,10 +11737,10 @@ main ()
iptr p = 0;
++p;
}
- { /* AIX XL C 1.02.0.0 rejects this sort of thing, saying
+ { /* AIX XL C 1.02.0.0 rejects this saying
"k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */
- struct s { int j; const int *ap[3]; } bx;
- struct s *b = &bx; b->j = 5;
+ struct s { int j; const int *ap[3]; };
+ struct s *b; b->j = 5;
}
{ /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */
const int foo = 10;
@@ -15008,16 +15029,16 @@ if (echo >conf$$.file) 2>/dev/null; then
# ... but there are two gotchas:
# 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
# 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
- # In both cases, we have to default to `cp -pR'.
+ # In both cases, we have to default to `cp -p'.
ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
- as_ln_s='cp -pR'
+ as_ln_s='cp -p'
elif ln conf$$.file conf$$ 2>/dev/null; then
as_ln_s=ln
else
- as_ln_s='cp -pR'
+ as_ln_s='cp -p'
fi
else
- as_ln_s='cp -pR'
+ as_ln_s='cp -p'
fi
rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
rmdir conf$$.dir 2>/dev/null
@@ -15077,16 +15098,28 @@ else
as_mkdir_p=false
fi fi
+# Check for dtrace support
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for --with-dtrace" >&5
+$as_echo_n "checking for --with-dtrace... " >&6; }
+
+# Check whether --with-dtrace was given.
+if test "${with_dtrace+set}" = set; then :
+ withval=$with_dtrace;
+fi
+
+
+if test ! -z "$with_dtrace"
+then
+ if dtrace -G -o /dev/null -s $srcdir/Include/pydtrace.d 2>/dev/null
+ then
+
+$as_echo "#define WITH_DTRACE 1" >>confdefs.h
+
+ with_dtrace="Sun"
+ DTRACEOBJS="Python/dtrace.o"
+ DTRADEHDRS=""
+ elif dtrace -h -o /dev/null -s $srcdir/Include/pydtrace.d
+ then
+
+$as_echo "#define WITH_DTRACE 1" >>confdefs.h
+
+ with_dtrace="Apple"
+ DTRACEOBJS=""
+ DTRADEHDRS="pydtrace.h"
+ else
+ with_dtrace="no"
+ fi
+else
+ with_dtrace="no"
+fi
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $with_dtrace" >&5
+$as_echo "$with_dtrace" >&6; }
+
+
+
# -I${DLINCLDIR} is added to the compile rule for importdl.o
DLINCLDIR=.
diff -up ./pyconfig.h.in.autotool-intermediates ./pyconfig.h.in
--- ./pyconfig.h.in.autotool-intermediates 2011-07-11 11:50:06.896426002 -0400
+++ ./pyconfig.h.in 2011-07-11 11:50:13.965426001 -0400
@@ -12,15 +12,15 @@
support for AIX C++ shared extension modules. */
#undef AIX_GENUINE_CPLUSPLUS
-/* Define if you have the Mach cthreads package */
-#undef C_THREADS
- -
/* Define to keep records on function call invocation */ -# as_fn_executable_p FILE
#undef CALL_PROFILE -# -----------------------
-# Test if FILE is an executable regular file.
-as_fn_executable_p ()
-{
- test -f "$1" && test -x "$1"
-} # as_fn_executable_p
-as_test_x='test -x'
-as_executable_p=as_fn_executable_p
+if test -x / >/dev/null 2>&1; then
+ as_test_x='test -x'
+else
+ if ls -dL / >/dev/null 2>&1; then
+ as_ls_L_option=L
+ else
+ as_ls_L_option=
+ fi
+ as_test_x='
+ eval sh -c '\''
+ if test -d "$1"; then
+ test -d "$1/.";
+ else
+ case $1 in #(
+ -*)set "./$1";;
+ esac;
+ case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #((
+ ???[sx]*):;;*)false;;esac;fi
+ '\'' sh
+ '
+fi
+as_executable_p=$as_test_x
/* Define to keep records of the number of instances of each type */ # Sed expression to map a string onto a valid CPP name.
#undef COUNT_ALLOCS as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
@@ -15108,7 +15141,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_wri
# values after options handling.
ac_log="
This file was extended by python $as_me 3.3, which was
-generated by GNU Autoconf 2.69. Invocation command line was
+generated by GNU Autoconf 2.68. Invocation command line was
+/* Define if you have the Mach cthreads package */ CONFIG_FILES = $CONFIG_FILES
+#undef C_THREADS CONFIG_HEADERS = $CONFIG_HEADERS
+ @@ -15170,10 +15203,10 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_writ
/* Define if C doubles are 64-bit IEEE 754 binary format, stored in ARM ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
mixed-endian order (byte order 45670123) */ ac_cs_version="\\
#undef DOUBLE_IS_ARM_MIXED_ENDIAN_IEEE754 python config.status 3.3
-configured by $0, generated by GNU Autoconf 2.69,
+configured by $0, generated by GNU Autoconf 2.68,
with options \\"\$ac_cs_config\\"
-Copyright (C) 2012 Free Software Foundation, Inc.
+Copyright (C) 2010 Free Software Foundation, Inc.
This config.status script is free software; the Free Software Foundation
gives unlimited permission to copy, distribute and modify it."
@@ -15263,7 +15296,7 @@ fi
_ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
if \$ac_cs_recheck; then
- set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion
+ set X '$SHELL' '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion
shift
\$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6
CONFIG_SHELL='$SHELL'
diff -up ./pyconfig.h.in.autotool-intermediates ./pyconfig.h.in

View File

@ -1,6 +1,6 @@
diff -up Python-3.2.3/Lib/distutils/command/install.py.lib64 Python-3.2.3/Lib/distutils/command/install.py diff -up Python-3.3.0b1/Lib/distutils/command/install.py.lib64 Python-3.3.0b1/Lib/distutils/command/install.py
--- Python-3.2.3/Lib/distutils/command/install.py.lib64 2012-04-11 02:54:02.000000000 -0400 --- Python-3.3.0b1/Lib/distutils/command/install.py.lib64 2012-06-26 16:19:41.000000000 -0400
+++ Python-3.2.3/Lib/distutils/command/install.py 2012-04-11 19:01:19.727107020 -0400 +++ Python-3.3.0b1/Lib/distutils/command/install.py 2012-07-20 13:09:38.760797382 -0400
@@ -45,14 +45,14 @@ else: @@ -45,14 +45,14 @@ else:
INSTALL_SCHEMES = { INSTALL_SCHEMES = {
'unix_prefix': { 'unix_prefix': {
@ -18,10 +18,10 @@ diff -up Python-3.2.3/Lib/distutils/command/install.py.lib64 Python-3.2.3/Lib/di
'headers': '$base/include/python/$dist_name', 'headers': '$base/include/python/$dist_name',
'scripts': '$base/bin', 'scripts': '$base/bin',
'data' : '$base', 'data' : '$base',
diff -up Python-3.2.3/Lib/distutils/sysconfig.py.lib64 Python-3.2.3/Lib/distutils/sysconfig.py diff -up Python-3.3.0b1/Lib/distutils/sysconfig.py.lib64 Python-3.3.0b1/Lib/distutils/sysconfig.py
--- Python-3.2.3/Lib/distutils/sysconfig.py.lib64 2012-04-11 02:54:02.000000000 -0400 --- Python-3.3.0b1/Lib/distutils/sysconfig.py.lib64 2012-06-26 16:19:41.000000000 -0400
+++ Python-3.2.3/Lib/distutils/sysconfig.py 2012-04-11 19:01:19.727107020 -0400 +++ Python-3.3.0b1/Lib/distutils/sysconfig.py 2012-07-20 13:12:48.017431348 -0400
@@ -122,8 +122,12 @@ def get_python_lib(plat_specific=0, stan @@ -138,8 +138,12 @@ def get_python_lib(plat_specific=0, stan
prefix = plat_specific and EXEC_PREFIX or PREFIX prefix = plat_specific and EXEC_PREFIX or PREFIX
if os.name == "posix": if os.name == "posix":
@ -35,10 +35,10 @@ diff -up Python-3.2.3/Lib/distutils/sysconfig.py.lib64 Python-3.2.3/Lib/distutil
if standard_lib: if standard_lib:
return libpython return libpython
else: else:
diff -up Python-3.2.3/Lib/site.py.lib64 Python-3.2.3/Lib/site.py diff -up Python-3.3.0b1/Lib/site.py.lib64 Python-3.3.0b1/Lib/site.py
--- Python-3.2.3/Lib/site.py.lib64 2012-04-11 02:54:03.000000000 -0400 --- Python-3.3.0b1/Lib/site.py.lib64 2012-06-26 16:19:45.000000000 -0400
+++ Python-3.2.3/Lib/site.py 2012-04-11 19:01:19.728107008 -0400 +++ Python-3.3.0b1/Lib/site.py 2012-07-20 13:09:38.762797357 -0400
@@ -285,12 +285,16 @@ def getsitepackages(): @@ -303,12 +303,16 @@ def getsitepackages(prefixes=None):
if sys.platform in ('os2emx', 'riscos'): if sys.platform in ('os2emx', 'riscos'):
sitepackages.append(os.path.join(prefix, "Lib", "site-packages")) sitepackages.append(os.path.join(prefix, "Lib", "site-packages"))
elif os.sep == '/': elif os.sep == '/':
@ -55,25 +55,25 @@ diff -up Python-3.2.3/Lib/site.py.lib64 Python-3.2.3/Lib/site.py
sitepackages.append(os.path.join(prefix, "lib", "site-packages")) sitepackages.append(os.path.join(prefix, "lib", "site-packages"))
if sys.platform == "darwin": if sys.platform == "darwin":
# for framework builds *only* we add the standard Apple # for framework builds *only* we add the standard Apple
diff -up Python-3.2.3/Lib/sysconfig.py.lib64 Python-3.2.3/Lib/sysconfig.py diff -up Python-3.3.0b1/Lib/sysconfig.py.lib64 Python-3.3.0b1/Lib/sysconfig.py
--- Python-3.2.3/Lib/sysconfig.py.lib64 2012-04-11 02:54:03.000000000 -0400 --- Python-3.3.0b1/Lib/sysconfig.py.lib64 2012-06-26 16:19:45.000000000 -0400
+++ Python-3.2.3/Lib/sysconfig.py 2012-04-11 19:01:19.728107008 -0400 +++ Python-3.3.0b1/Lib/sysconfig.py 2012-07-20 13:14:59.721784816 -0400
@@ -21,10 +21,10 @@ __all__ = [ @@ -21,10 +21,10 @@ __all__ = [
_INSTALL_SCHEMES = { _INSTALL_SCHEMES = {
'posix_prefix': { 'posix_prefix': {
- 'stdlib': '{base}/lib/python{py_version_short}', - 'stdlib': '{installed_base}/lib/python{py_version_short}',
- 'platstdlib': '{platbase}/lib/python{py_version_short}', - 'platstdlib': '{platbase}/lib/python{py_version_short}',
+ 'stdlib': '{base}/lib64/python{py_version_short}', + 'stdlib': '{installed_base}/lib64/python{py_version_short}',
+ 'platstdlib': '{platbase}/lib64/python{py_version_short}', + 'platstdlib': '{platbase}/lib64/python{py_version_short}',
'purelib': '{base}/lib/python{py_version_short}/site-packages', 'purelib': '{base}/lib/python{py_version_short}/site-packages',
- 'platlib': '{platbase}/lib/python{py_version_short}/site-packages', - 'platlib': '{platbase}/lib/python{py_version_short}/site-packages',
+ 'platlib': '{platbase}/lib64/python{py_version_short}/site-packages', + 'platlib': '{platbase}/lib64/python{py_version_short}/site-packages',
'include': 'include':
'{base}/include/python{py_version_short}{abiflags}', '{installed_base}/include/python{py_version_short}{abiflags}',
'platinclude': 'platinclude':
@@ -81,10 +81,10 @@ _INSTALL_SCHEMES = { @@ -81,10 +81,10 @@ _INSTALL_SCHEMES = {
'data' : '{userbase}', 'data': '{userbase}',
}, },
'posix_user': { 'posix_user': {
- 'stdlib': '{userbase}/lib/python{py_version_short}', - 'stdlib': '{userbase}/lib/python{py_version_short}',
@ -85,11 +85,11 @@ diff -up Python-3.2.3/Lib/sysconfig.py.lib64 Python-3.2.3/Lib/sysconfig.py
+ 'platlib': '{userbase}/lib64/python{py_version_short}/site-packages', + 'platlib': '{userbase}/lib64/python{py_version_short}/site-packages',
'include': '{userbase}/include/python{py_version_short}', 'include': '{userbase}/include/python{py_version_short}',
'scripts': '{userbase}/bin', 'scripts': '{userbase}/bin',
'data' : '{userbase}', 'data': '{userbase}',
diff -up Python-3.2.3/Lib/test/test_site.py.lib64 Python-3.2.3/Lib/test/test_site.py diff -up Python-3.3.0b1/Lib/test/test_site.py.lib64 Python-3.3.0b1/Lib/test/test_site.py
--- Python-3.2.3/Lib/test/test_site.py.lib64 2012-04-11 02:54:05.000000000 -0400 --- Python-3.3.0b1/Lib/test/test_site.py.lib64 2012-06-26 16:19:48.000000000 -0400
+++ Python-3.2.3/Lib/test/test_site.py 2012-04-11 19:02:01.413585869 -0400 +++ Python-3.3.0b1/Lib/test/test_site.py 2012-07-20 13:09:38.764797333 -0400
@@ -236,12 +236,15 @@ class HelperFunctionsTests(unittest.Test @@ -239,12 +239,15 @@ class HelperFunctionsTests(unittest.Test
self.assertEqual(dirs[2], wanted) self.assertEqual(dirs[2], wanted)
elif os.sep == '/': elif os.sep == '/':
# OS X non-framwework builds, Linux, FreeBSD, etc # OS X non-framwework builds, Linux, FreeBSD, etc
@ -108,10 +108,10 @@ diff -up Python-3.2.3/Lib/test/test_site.py.lib64 Python-3.2.3/Lib/test/test_sit
else: else:
# other platforms # other platforms
self.assertEqual(len(dirs), 2) self.assertEqual(len(dirs), 2)
diff -up Python-3.2.3/Makefile.pre.in.lib64 Python-3.2.3/Makefile.pre.in diff -up Python-3.3.0b1/Makefile.pre.in.lib64 Python-3.3.0b1/Makefile.pre.in
--- Python-3.2.3/Makefile.pre.in.lib64 2012-04-11 19:01:19.722107084 -0400 --- Python-3.3.0b1/Makefile.pre.in.lib64 2012-07-20 13:09:38.742797608 -0400
+++ Python-3.2.3/Makefile.pre.in 2012-04-11 19:01:19.729106996 -0400 +++ Python-3.3.0b1/Makefile.pre.in 2012-07-20 13:09:38.765797321 -0400
@@ -106,7 +106,7 @@ LIBDIR= @libdir@ @@ -107,7 +107,7 @@ LIBDIR= @libdir@
MANDIR= @mandir@ MANDIR= @mandir@
INCLUDEDIR= @includedir@ INCLUDEDIR= @includedir@
CONFINCLUDEDIR= $(exec_prefix)/include CONFINCLUDEDIR= $(exec_prefix)/include
@ -120,9 +120,9 @@ diff -up Python-3.2.3/Makefile.pre.in.lib64 Python-3.2.3/Makefile.pre.in
ABIFLAGS= @ABIFLAGS@ ABIFLAGS= @ABIFLAGS@
# Detailed destination directories # Detailed destination directories
diff -up Python-3.2.3/Modules/getpath.c.lib64 Python-3.2.3/Modules/getpath.c diff -up Python-3.3.0b1/Modules/getpath.c.lib64 Python-3.3.0b1/Modules/getpath.c
--- Python-3.2.3/Modules/getpath.c.lib64 2012-04-11 02:54:07.000000000 -0400 --- Python-3.3.0b1/Modules/getpath.c.lib64 2012-06-26 16:19:54.000000000 -0400
+++ Python-3.2.3/Modules/getpath.c 2012-04-11 19:01:19.729106996 -0400 +++ Python-3.3.0b1/Modules/getpath.c 2012-07-20 13:09:38.766797308 -0400
@@ -122,8 +122,8 @@ @@ -122,8 +122,8 @@
#endif #endif
@ -143,7 +143,7 @@ diff -up Python-3.2.3/Modules/getpath.c.lib64 Python-3.2.3/Modules/getpath.c
static void static void
reduce(wchar_t *dir) reduce(wchar_t *dir)
@@ -583,7 +583,7 @@ calculate_path(void) @@ -669,7 +669,7 @@ calculate_path(void)
} }
else else
wcsncpy(zip_path, _prefix, MAXPATHLEN); wcsncpy(zip_path, _prefix, MAXPATHLEN);
@ -152,7 +152,7 @@ diff -up Python-3.2.3/Modules/getpath.c.lib64 Python-3.2.3/Modules/getpath.c
bufsz = wcslen(zip_path); /* Replace "00" with version */ bufsz = wcslen(zip_path); /* Replace "00" with version */
zip_path[bufsz - 6] = VERSION[0]; zip_path[bufsz - 6] = VERSION[0];
zip_path[bufsz - 5] = VERSION[2]; zip_path[bufsz - 5] = VERSION[2];
@@ -593,7 +593,7 @@ calculate_path(void) @@ -679,7 +679,7 @@ calculate_path(void)
fprintf(stderr, fprintf(stderr,
"Could not find platform dependent libraries <exec_prefix>\n"); "Could not find platform dependent libraries <exec_prefix>\n");
wcsncpy(exec_prefix, _exec_prefix, MAXPATHLEN); wcsncpy(exec_prefix, _exec_prefix, MAXPATHLEN);
@ -161,10 +161,10 @@ diff -up Python-3.2.3/Modules/getpath.c.lib64 Python-3.2.3/Modules/getpath.c
} }
/* If we found EXEC_PREFIX do *not* reduce it! (Yet.) */ /* If we found EXEC_PREFIX do *not* reduce it! (Yet.) */
diff -up Python-3.2.3/setup.py.lib64 Python-3.2.3/setup.py diff -up Python-3.3.0b1/setup.py.lib64 Python-3.3.0b1/setup.py
--- Python-3.2.3/setup.py.lib64 2012-04-11 02:54:08.000000000 -0400 --- Python-3.3.0b1/setup.py.lib64 2012-06-26 16:19:58.000000000 -0400
+++ Python-3.2.3/setup.py 2012-04-11 19:01:19.730106984 -0400 +++ Python-3.3.0b1/setup.py 2012-07-20 13:09:38.767797295 -0400
@@ -396,7 +396,7 @@ class PyBuildExt(build_ext): @@ -393,7 +393,7 @@ class PyBuildExt(build_ext):
# Ensure that /usr/local is always used, but the local build # Ensure that /usr/local is always used, but the local build
# directories (i.e. '.' and 'Include') must be first. See issue # directories (i.e. '.' and 'Include') must be first. See issue
# 10520. # 10520.
@ -173,7 +173,7 @@ diff -up Python-3.2.3/setup.py.lib64 Python-3.2.3/setup.py
add_dir_to_list(self.compiler.include_dirs, '/usr/local/include') add_dir_to_list(self.compiler.include_dirs, '/usr/local/include')
self.add_multiarch_paths() self.add_multiarch_paths()
@@ -643,11 +643,11 @@ class PyBuildExt(build_ext): @@ -652,11 +652,11 @@ class PyBuildExt(build_ext):
elif curses_library: elif curses_library:
readline_libs.append(curses_library) readline_libs.append(curses_library)
elif self.compiler.find_library_file(lib_dirs + elif self.compiler.find_library_file(lib_dirs +
@ -187,7 +187,7 @@ diff -up Python-3.2.3/setup.py.lib64 Python-3.2.3/setup.py
extra_link_args=readline_extra_link_args, extra_link_args=readline_extra_link_args,
libraries=readline_libs) ) libraries=readline_libs) )
else: else:
@@ -684,8 +684,8 @@ class PyBuildExt(build_ext): @@ -693,8 +693,8 @@ class PyBuildExt(build_ext):
if krb5_h: if krb5_h:
ssl_incs += krb5_h ssl_incs += krb5_h
ssl_libs = find_library_file(self.compiler, 'ssl',lib_dirs, ssl_libs = find_library_file(self.compiler, 'ssl',lib_dirs,

View File

@ -2,10 +2,11 @@
# Conditionals and other variables controlling the build # Conditionals and other variables controlling the build
# ====================================================== # ======================================================
%global pybasever 3.2 %global pybasever 3.3
%global alphatag b1
# pybasever without the dot: # pybasever without the dot:
%global pyshortver 32 %global pyshortver 33
%global pylibdir %{_libdir}/python%{pybasever} %global pylibdir %{_libdir}/python%{pybasever}
%global dynload_dir %{pylibdir}/lib-dynload %global dynload_dir %{pylibdir}/lib-dynload
@ -14,9 +15,13 @@
# for PEP 3149: # for PEP 3149:
# http://www.python.org/dev/peps/pep-3149/ # http://www.python.org/dev/peps/pep-3149/
# ("configure.in" became "configure.ac" in Python 3.3 onwards, and in
# backports)
# ABIFLAGS, LDVERSION and SOABI are in the upstream Makefile # ABIFLAGS, LDVERSION and SOABI are in the upstream Makefile
%global ABIFLAGS_optimized mu # With Python 3.3, we lose the "u" suffix due to PEP 393
%global ABIFLAGS_debug dmu %global ABIFLAGS_optimized m
%global ABIFLAGS_debug dm
%global LDVERSION_optimized %{pybasever}%{ABIFLAGS_optimized} %global LDVERSION_optimized %{pybasever}%{ABIFLAGS_optimized}
%global LDVERSION_debug %{pybasever}%{ABIFLAGS_debug} %global LDVERSION_debug %{pybasever}%{ABIFLAGS_debug}
@ -31,9 +36,9 @@
# For example, # For example,
# foo/bar.py # foo/bar.py
# now has bytecode at: # now has bytecode at:
# foo/__pycache__/bar.cpython-32.pyc # foo/__pycache__/bar.cpython-33.pyc
# foo/__pycache__/bar.cpython-32.pyo # foo/__pycache__/bar.cpython-33.pyo
%global bytecode_suffixes .cpython-32.py? %global bytecode_suffixes .cpython-33.py?
# Python's configure script defines SOVERSION, and this is used in the Makefile # Python's configure script defines SOVERSION, and this is used in the Makefile
# to determine INSTSONAME, the name of the libpython DSO: # to determine INSTSONAME, the name of the libpython DSO:
@ -121,8 +126,8 @@
# ================== # ==================
Summary: Version 3 of the Python programming language aka Python 3000 Summary: Version 3 of the Python programming language aka Python 3000
Name: python3 Name: python3
Version: %{pybasever}.3 Version: %{pybasever}.0
Release: 11%{?dist} Release: 0.1.%{alphatag}%{?dist}
License: Python License: Python
Group: Development/Languages Group: Development/Languages
@ -174,15 +179,15 @@ BuildRequires: tk-devel
BuildRequires: valgrind-devel BuildRequires: valgrind-devel
%endif %endif
BuildRequires: xz-devel
BuildRequires: zlib-devel BuildRequires: zlib-devel
# ======================= # =======================
# Source code and patches # Source code and patches
# ======================= # =======================
Source: http://www.python.org/ftp/python/%{version}/Python-%{version}.tar.xz Source: http://www.python.org/ftp/python/%{version}/Python-%{version}%{alphatag}.tar.xz
# Avoid having various bogus auto-generated Provides lines for the various # Avoid having various bogus auto-generated Provides lines for the various
# python c modules' SONAMEs: # python c modules' SONAMEs:
@ -219,17 +224,14 @@ Patch1: Python-3.1.1-rpath.patch
# The four TestMIMEAudio tests fail due to "audiotest.au" not being packaged. # The four TestMIMEAudio tests fail due to "audiotest.au" not being packaged.
# It's simplest to remove them: # It's simplest to remove them:
Patch3: python-3.2b2-remove-mimeaudio-tests.patch Patch3: 00003-remove-mimeaudio-tests.patch
# 00055 # # 00055 #
# Systemtap support: add statically-defined probe points # Systemtap support: add statically-defined probe points
# Patch based on upstream bug: http://bugs.python.org/issue4111 # Patch sent upstream as http://bugs.python.org/issue14776
# fixed up by mjw and wcohen for 2.6.2, then fixed up by dmalcolm for 2.6.4
# then rewritten by mjw (attachment 390110 of rhbz 545179); ported to 3.1.1 by
# dmalcolm
Patch55: 00055-systemtap.patch Patch55: 00055-systemtap.patch
Patch102: python-3.2.3-lib64.patch Patch102: python-3.3.0b1-lib64.patch
# 00104 # # 00104 #
# Only used when "%{_lib}" == "lib64" # Only used when "%{_lib}" == "lib64"
@ -387,9 +389,9 @@ Patch146: 00146-hashlib-fips.patch
# 00147 # # 00147 #
# Add a sys._debugmallocstats() function # Add a sys._debugmallocstats() function
# Based on patch 202 from RHEL 5's python.spec, with updates from rhbz#737198
# Sent upstream as http://bugs.python.org/issue14785 # Sent upstream as http://bugs.python.org/issue14785
Patch147: 00147-add-debug-malloc-stats.patch # Upstream as of Python 3.3.0
# Patch147: 00147-add-debug-malloc-stats.patch
# 00148 # # 00148 #
# Upstream as of Python 3.2.3: # Upstream as of Python 3.2.3:
@ -456,6 +458,43 @@ Patch156: 00156-gdb-autoload-safepath.patch
# (rhbz#697470) # (rhbz#697470)
Patch157: 00157-uid-gid-overflows.patch Patch157: 00157-uid-gid-overflows.patch
# 00158 #
# Patch158: 00158-fix-hashlib-leak.patch
# in python.spec
# TODO: python3 status?
# 00159 #
# Patch159: 00159-correct-libdb-include-path.patch
# in python.spec
# TODO: python3 status?
# 00160 #
# Python 3.3 added os.SEEK_DATA and os.SEEK_HOLE, which may be present in the
# header files in the build chroot, but may not be supported in the running
# kernel, hence we disable this test in an rpm build.
# Adding these was upstream issue http://bugs.python.org/issue10142
# Not yet sent upstream
Patch160: 00160-disable-test_fs_holes-in-rpm-build.patch
# 00161 #
# http://bugs.python.org/issue13447 added tests for the Tools scripts, but
# these appear to assume that srcdir == builddir, which isn't the case for our
# builds.
# Not yet sent upstream
Patch161: 00161-fix-test_tools-directory.patch
# 00162 #
# Fix a bug in distutils.sysconfig.get_config_vars() in which find_executable()
# would traceback when "CC" contains options (e.g. "gcc -pthread")
# Not yet sent upstream
Patch162: 00162-distutils-sysconfig-fix-CC-options.patch
# 00163 #
# Some tests within test_socket fail intermittently when run inside Koji;
# disable them using unittest._skipInRpmBuild
# Not yet sent upstream
Patch163: 00163-disable-parts-of-test_socket-in-rpm-build.patch
# (New patches go here ^^^) # (New patches go here ^^^)
# #
# When adding new patches to "python" and "python3" in Fedora 17 onwards, # When adding new patches to "python" and "python3" in Fedora 17 onwards,
@ -594,7 +633,7 @@ can load its own extensions.
# ====================================================== # ======================================================
%prep %prep
%setup -q -n Python-%{version} %setup -q -n Python-%{version}%{alphatag}
chmod +x %{SOURCE1} chmod +x %{SOURCE1}
%if 0%{?with_systemtap} %if 0%{?with_systemtap}
@ -671,7 +710,7 @@ done
# 00144: not for python3 # 00144: not for python3
# 00145: not for python3 # 00145: not for python3
%patch146 -p1 %patch146 -p1
%patch147 -p1 # 00147: upstream as of Python 3.3.0
# 00148: upstream as of Python 3.2.3 # 00148: upstream as of Python 3.2.3
# 00149: upstream as of Python 3.2.3 # 00149: upstream as of Python 3.2.3
%ifarch ppc %{power64} %ifarch ppc %{power64}
@ -684,6 +723,12 @@ done
%patch155 -p1 %patch155 -p1
%patch156 -p1 %patch156 -p1
%patch157 -p1 %patch157 -p1
#00158: FIXME
#00159: FIXME
%patch160 -p1
%patch161 -p1
%patch162 -p1
%patch163 -p1
# Currently (2010-01-15), http://docs.python.org/library is for 2.6, and there # Currently (2010-01-15), http://docs.python.org/library is for 2.6, and there
# are many differences between 2.6 and the Python 3 library. # are many differences between 2.6 and the Python 3 library.
@ -765,10 +810,8 @@ BuildPython() {
--with-dbmliborder=gdbm:ndbm:bdb \ --with-dbmliborder=gdbm:ndbm:bdb \
--with-system-expat \ --with-system-expat \
--with-system-ffi \ --with-system-ffi \
--with-wide-unicode \
%if 0%{?with_systemtap} %if 0%{?with_systemtap}
--with-dtrace \ --with-systemtap \
--with-tapset-install-dir=%{tapsetdir} \
%endif %endif
%if 0%{?with_valgrind} %if 0%{?with_valgrind}
--with-valgrind \ --with-valgrind \
@ -832,6 +875,12 @@ InstallPython() {
pushd $ConfDir pushd $ConfDir
# Workaround for http://bugs.python.org/issue14774 : Lib/_sysconfigdata.py
# is in the srcdir but contains per-config data.
# Regenerate it each time:
rm -f ../../Lib/_sysconfigdata.py
make $topdir/Lib/_sysconfigdata.py
make install DESTDIR=%{buildroot} INSTALL="install -p" make install DESTDIR=%{buildroot} INSTALL="install -p"
popd popd
@ -919,8 +968,8 @@ install -d -m 0755 %{buildroot}/usr/lib/python%{pybasever}/site-packages/__pycac
%endif %endif
# ABIFLAGS, LDVERSION and SOABI are in the upstream Makefile # ABIFLAGS, LDVERSION and SOABI are in the upstream Makefile
%global ABIFLAGS_optimized mu %global ABIFLAGS_optimized m
%global ABIFLAGS_debug dmu %global ABIFLAGS_debug dm
%global LDVERSION_optimized %{pybasever}%{ABIFLAGS_optimized} %global LDVERSION_optimized %{pybasever}%{ABIFLAGS_optimized}
%global LDVERSION_debug %{pybasever}%{ABIFLAGS_debug} %global LDVERSION_debug %{pybasever}%{ABIFLAGS_debug}
@ -1113,6 +1162,13 @@ CheckPython() {
# Note that we're running the tests using the version of the code in the # Note that we're running the tests using the version of the code in the
# builddir, not in the buildroot. # builddir, not in the buildroot.
# Workaround for http://bugs.python.org/issue14774, as per the install
# stanza (albeit from a different directory):
rm -f Lib/_sysconfigdata.py
pushd $ConfDir
make $topdir/Lib/_sysconfigdata.py
popd
# Run the upstream test suite, setting "WITHIN_PYTHON_RPM_BUILD" so that the # Run the upstream test suite, setting "WITHIN_PYTHON_RPM_BUILD" so that the
# our non-standard decorators take effect on the relevant tests: # our non-standard decorators take effect on the relevant tests:
# @unittest._skipInRpmBuild(reason) # @unittest._skipInRpmBuild(reason)
@ -1160,7 +1216,9 @@ rm -fr %{buildroot}
%{_bindir}/pydoc* %{_bindir}/pydoc*
%{_bindir}/python3 %{_bindir}/python3
%{_bindir}/python%{pybasever} %{_bindir}/python%{pybasever}
%{_bindir}/python%{pybasever}mu %{_bindir}/python%{pybasever}m
%{_bindir}/pyvenv
%{_bindir}/pyvenv-3.3
%{_mandir}/*/* %{_mandir}/*/*
%files libs %files libs
@ -1168,19 +1226,21 @@ rm -fr %{buildroot}
%doc LICENSE README %doc LICENSE README
%dir %{pylibdir} %dir %{pylibdir}
%dir %{dynload_dir} %dir %{dynload_dir}
%{dynload_dir}/Python-%{version}-py%{pybasever}.egg-info
%{dynload_dir}/_bisect.%{SOABI_optimized}.so %{dynload_dir}/_bisect.%{SOABI_optimized}.so
%{dynload_dir}/_bz2.%{SOABI_optimized}.so
%{dynload_dir}/_codecs_cn.%{SOABI_optimized}.so %{dynload_dir}/_codecs_cn.%{SOABI_optimized}.so
%{dynload_dir}/_codecs_hk.%{SOABI_optimized}.so %{dynload_dir}/_codecs_hk.%{SOABI_optimized}.so
%{dynload_dir}/_codecs_iso2022.%{SOABI_optimized}.so %{dynload_dir}/_codecs_iso2022.%{SOABI_optimized}.so
%{dynload_dir}/_codecs_jp.%{SOABI_optimized}.so %{dynload_dir}/_codecs_jp.%{SOABI_optimized}.so
%{dynload_dir}/_codecs_kr.%{SOABI_optimized}.so %{dynload_dir}/_codecs_kr.%{SOABI_optimized}.so
%{dynload_dir}/_codecs_tw.%{SOABI_optimized}.so %{dynload_dir}/_codecs_tw.%{SOABI_optimized}.so
%{dynload_dir}/_crypt.%{SOABI_optimized}.so
%{dynload_dir}/_csv.%{SOABI_optimized}.so %{dynload_dir}/_csv.%{SOABI_optimized}.so
%{dynload_dir}/_ctypes.%{SOABI_optimized}.so %{dynload_dir}/_ctypes.%{SOABI_optimized}.so
%{dynload_dir}/_curses.%{SOABI_optimized}.so %{dynload_dir}/_curses.%{SOABI_optimized}.so
%{dynload_dir}/_curses_panel.%{SOABI_optimized}.so %{dynload_dir}/_curses_panel.%{SOABI_optimized}.so
%{dynload_dir}/_dbm.%{SOABI_optimized}.so %{dynload_dir}/_dbm.%{SOABI_optimized}.so
%{dynload_dir}/_decimal.%{SOABI_optimized}.so
%{dynload_dir}/_elementtree.%{SOABI_optimized}.so %{dynload_dir}/_elementtree.%{SOABI_optimized}.so
%if %{with_gdbm} %if %{with_gdbm}
%{dynload_dir}/_gdbm.%{SOABI_optimized}.so %{dynload_dir}/_gdbm.%{SOABI_optimized}.so
@ -1189,6 +1249,7 @@ rm -fr %{buildroot}
%{dynload_dir}/_heapq.%{SOABI_optimized}.so %{dynload_dir}/_heapq.%{SOABI_optimized}.so
%{dynload_dir}/_json.%{SOABI_optimized}.so %{dynload_dir}/_json.%{SOABI_optimized}.so
%{dynload_dir}/_lsprof.%{SOABI_optimized}.so %{dynload_dir}/_lsprof.%{SOABI_optimized}.so
%{dynload_dir}/_lzma.%{SOABI_optimized}.so
%{dynload_dir}/_multibytecodec.%{SOABI_optimized}.so %{dynload_dir}/_multibytecodec.%{SOABI_optimized}.so
%{dynload_dir}/_multiprocessing.%{SOABI_optimized}.so %{dynload_dir}/_multiprocessing.%{SOABI_optimized}.so
%{dynload_dir}/_pickle.%{SOABI_optimized}.so %{dynload_dir}/_pickle.%{SOABI_optimized}.so
@ -1202,9 +1263,7 @@ rm -fr %{buildroot}
%{dynload_dir}/atexit.%{SOABI_optimized}.so %{dynload_dir}/atexit.%{SOABI_optimized}.so
%{dynload_dir}/audioop.%{SOABI_optimized}.so %{dynload_dir}/audioop.%{SOABI_optimized}.so
%{dynload_dir}/binascii.%{SOABI_optimized}.so %{dynload_dir}/binascii.%{SOABI_optimized}.so
%{dynload_dir}/bz2.%{SOABI_optimized}.so
%{dynload_dir}/cmath.%{SOABI_optimized}.so %{dynload_dir}/cmath.%{SOABI_optimized}.so
%{dynload_dir}/crypt.%{SOABI_optimized}.so
%{dynload_dir}/_datetime.%{SOABI_optimized}.so %{dynload_dir}/_datetime.%{SOABI_optimized}.so
%{dynload_dir}/fcntl.%{SOABI_optimized}.so %{dynload_dir}/fcntl.%{SOABI_optimized}.so
%{dynload_dir}/grp.%{SOABI_optimized}.so %{dynload_dir}/grp.%{SOABI_optimized}.so
@ -1231,7 +1290,11 @@ rm -fr %{buildroot}
%{pylibdir}/*.py %{pylibdir}/*.py
%dir %{pylibdir}/__pycache__/ %dir %{pylibdir}/__pycache__/
%{pylibdir}/__pycache__/*%{bytecode_suffixes} %{pylibdir}/__pycache__/*%{bytecode_suffixes}
%{pylibdir}/wsgiref.egg-info
%dir %{pylibdir}/collections/
%dir %{pylibdir}/collections/__pycache__/
%{pylibdir}/collections/*.py
%{pylibdir}/collections/__pycache__/*%{bytecode_suffixes}
%dir %{pylibdir}/concurrent/ %dir %{pylibdir}/concurrent/
%dir %{pylibdir}/concurrent/__pycache__/ %dir %{pylibdir}/concurrent/__pycache__/
@ -1268,6 +1331,7 @@ rm -fr %{buildroot}
%{pylibdir}/email/*.py %{pylibdir}/email/*.py
%{pylibdir}/email/__pycache__/*%{bytecode_suffixes} %{pylibdir}/email/__pycache__/*%{bytecode_suffixes}
%{pylibdir}/email/mime %{pylibdir}/email/mime
%doc %{pylibdir}/email/architecture.rst
%{pylibdir}/encodings %{pylibdir}/encodings
%{pylibdir}/html %{pylibdir}/html
@ -1288,7 +1352,7 @@ rm -fr %{buildroot}
%exclude %{pylibdir}/lib2to3/tests %exclude %{pylibdir}/lib2to3/tests
%{pylibdir}/logging %{pylibdir}/logging
%{pylibdir}/multiprocessing %{pylibdir}/multiprocessing
%{pylibdir}/plat-linux2 %{pylibdir}/plat-linux
%{pylibdir}/pydoc_data %{pylibdir}/pydoc_data
%dir %{pylibdir}/sqlite3/ %dir %{pylibdir}/sqlite3/
@ -1312,6 +1376,13 @@ rm -fr %{buildroot}
%{pylibdir}/unittest/__pycache__/*%{bytecode_suffixes} %{pylibdir}/unittest/__pycache__/*%{bytecode_suffixes}
%{pylibdir}/urllib %{pylibdir}/urllib
%dir %{pylibdir}/venv/
%dir %{pylibdir}/venv/__pycache__/
%{pylibdir}/venv/*.py
%{pylibdir}/venv/__pycache__/*%{bytecode_suffixes}
%{pylibdir}/venv/scripts
%{pylibdir}/wsgiref %{pylibdir}/wsgiref
%{pylibdir}/xml %{pylibdir}/xml
%{pylibdir}/xmlrpc %{pylibdir}/xmlrpc
@ -1380,11 +1451,11 @@ rm -fr %{buildroot}
%defattr(-, root, root) %defattr(-, root, root)
%{pylibdir}/ctypes/test %{pylibdir}/ctypes/test
%{pylibdir}/distutils/tests %{pylibdir}/distutils/tests
%{pylibdir}/email/test
%{pylibdir}/importlib/test %{pylibdir}/importlib/test
%{pylibdir}/sqlite3/test %{pylibdir}/sqlite3/test
%{pylibdir}/test %{pylibdir}/test
%{dynload_dir}/_ctypes_test.%{SOABI_optimized}.so %{dynload_dir}/_ctypes_test.%{SOABI_optimized}.so
%{dynload_dir}/_testbuffer.%{SOABI_optimized}.so
%{dynload_dir}/_testcapi.%{SOABI_optimized}.so %{dynload_dir}/_testcapi.%{SOABI_optimized}.so
%{pylibdir}/lib2to3/tests %{pylibdir}/lib2to3/tests
%{pylibdir}/tkinter/test %{pylibdir}/tkinter/test
@ -1408,17 +1479,20 @@ rm -fr %{buildroot}
# Analog of the -libs subpackage's files: # Analog of the -libs subpackage's files:
# ...with debug builds of the built-in "extension" modules: # ...with debug builds of the built-in "extension" modules:
%{dynload_dir}/_bisect.%{SOABI_debug}.so %{dynload_dir}/_bisect.%{SOABI_debug}.so
%{dynload_dir}/_bz2.%{SOABI_debug}.so
%{dynload_dir}/_codecs_cn.%{SOABI_debug}.so %{dynload_dir}/_codecs_cn.%{SOABI_debug}.so
%{dynload_dir}/_codecs_hk.%{SOABI_debug}.so %{dynload_dir}/_codecs_hk.%{SOABI_debug}.so
%{dynload_dir}/_codecs_iso2022.%{SOABI_debug}.so %{dynload_dir}/_codecs_iso2022.%{SOABI_debug}.so
%{dynload_dir}/_codecs_jp.%{SOABI_debug}.so %{dynload_dir}/_codecs_jp.%{SOABI_debug}.so
%{dynload_dir}/_codecs_kr.%{SOABI_debug}.so %{dynload_dir}/_codecs_kr.%{SOABI_debug}.so
%{dynload_dir}/_codecs_tw.%{SOABI_debug}.so %{dynload_dir}/_codecs_tw.%{SOABI_debug}.so
%{dynload_dir}/_crypt.%{SOABI_debug}.so
%{dynload_dir}/_csv.%{SOABI_debug}.so %{dynload_dir}/_csv.%{SOABI_debug}.so
%{dynload_dir}/_ctypes.%{SOABI_debug}.so %{dynload_dir}/_ctypes.%{SOABI_debug}.so
%{dynload_dir}/_curses.%{SOABI_debug}.so %{dynload_dir}/_curses.%{SOABI_debug}.so
%{dynload_dir}/_curses_panel.%{SOABI_debug}.so %{dynload_dir}/_curses_panel.%{SOABI_debug}.so
%{dynload_dir}/_dbm.%{SOABI_debug}.so %{dynload_dir}/_dbm.%{SOABI_debug}.so
%{dynload_dir}/_decimal.%{SOABI_debug}.so
%{dynload_dir}/_elementtree.%{SOABI_debug}.so %{dynload_dir}/_elementtree.%{SOABI_debug}.so
%if %{with_gdbm} %if %{with_gdbm}
%{dynload_dir}/_gdbm.%{SOABI_debug}.so %{dynload_dir}/_gdbm.%{SOABI_debug}.so
@ -1427,6 +1501,7 @@ rm -fr %{buildroot}
%{dynload_dir}/_heapq.%{SOABI_debug}.so %{dynload_dir}/_heapq.%{SOABI_debug}.so
%{dynload_dir}/_json.%{SOABI_debug}.so %{dynload_dir}/_json.%{SOABI_debug}.so
%{dynload_dir}/_lsprof.%{SOABI_debug}.so %{dynload_dir}/_lsprof.%{SOABI_debug}.so
%{dynload_dir}/_lzma.%{SOABI_debug}.so
%{dynload_dir}/_multibytecodec.%{SOABI_debug}.so %{dynload_dir}/_multibytecodec.%{SOABI_debug}.so
%{dynload_dir}/_multiprocessing.%{SOABI_debug}.so %{dynload_dir}/_multiprocessing.%{SOABI_debug}.so
%{dynload_dir}/_pickle.%{SOABI_debug}.so %{dynload_dir}/_pickle.%{SOABI_debug}.so
@ -1440,9 +1515,7 @@ rm -fr %{buildroot}
%{dynload_dir}/atexit.%{SOABI_debug}.so %{dynload_dir}/atexit.%{SOABI_debug}.so
%{dynload_dir}/audioop.%{SOABI_debug}.so %{dynload_dir}/audioop.%{SOABI_debug}.so
%{dynload_dir}/binascii.%{SOABI_debug}.so %{dynload_dir}/binascii.%{SOABI_debug}.so
%{dynload_dir}/bz2.%{SOABI_debug}.so
%{dynload_dir}/cmath.%{SOABI_debug}.so %{dynload_dir}/cmath.%{SOABI_debug}.so
%{dynload_dir}/crypt.%{SOABI_debug}.so
%{dynload_dir}/_datetime.%{SOABI_debug}.so %{dynload_dir}/_datetime.%{SOABI_debug}.so
%{dynload_dir}/fcntl.%{SOABI_debug}.so %{dynload_dir}/fcntl.%{SOABI_debug}.so
%{dynload_dir}/grp.%{SOABI_debug}.so %{dynload_dir}/grp.%{SOABI_debug}.so
@ -1487,6 +1560,7 @@ rm -fr %{buildroot}
# Analog of the -test subpackage's files: # Analog of the -test subpackage's files:
%{dynload_dir}/_ctypes_test.%{SOABI_debug}.so %{dynload_dir}/_ctypes_test.%{SOABI_debug}.so
%{dynload_dir}/_testbuffer.%{SOABI_debug}.so
%{dynload_dir}/_testcapi.%{SOABI_debug}.so %{dynload_dir}/_testcapi.%{SOABI_debug}.so
%endif # with_debug_build %endif # with_debug_build
@ -1510,9 +1584,26 @@ rm -fr %{buildroot}
# ====================================================== # ======================================================
%changelog %changelog
* Fri Aug 3 2012 David Malcolm <dmalcolm@redhat.com> - 3.3.0-0.1.b1
- 3.2 -> 3.3: https://fedoraproject.org/wiki/Features/Python_3.3
- 3.3.0b1: refresh patches 3, 55, 102, 111, 113, 114, 134, 157; drop upstream
patch 147; regenenerate autotools patch; drop "--with-wide-unicode" from
configure (PEP 393); "plat-linux2" -> "plat-linux" (upstream issue 12326);
"bz2" -> "_bz2" and "crypt" -> "_crypt"; egg-info files are no longer shipped
for stdlib (upstream issues 10645 and 12218); email/test moved to
test/test_email; add /usr/bin/pyvenv[-3.3] and venv module (PEP 405); add
_decimal and _lzma modules; make collections modules explicit in payload again
(upstream issue 11085); add _testbuffer module to tests subpackage (added in
upstream commit 3f9b3b6f7ff0); fix test failures (patches 160 and 161);
workaround erroneously shared _sysconfigdata.py upstream issue #14774; fix
distutils.sysconfig traceback (patch 162); add BuildRequires: xz-devel (for
_lzma module); skip some tests within test_socket (patch 163)
* Sat Jul 21 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.2.3-11 * Sat Jul 21 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.2.3-11
- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild - Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild
* Fri Jul 20 2012 David Malcolm <dmalcolm@redhat.com> - 3.3.0-0.1.b1
* Fri Jun 22 2012 David Malcolm <dmalcolm@redhat.com> - 3.2.3-10 * Fri Jun 22 2012 David Malcolm <dmalcolm@redhat.com> - 3.2.3-10
- use macro for power64 (rhbz#834653) - use macro for power64 (rhbz#834653)

View File

@ -1 +1 @@
187564726f2c1473d301c586acc24847 Python-3.2.3.tar.xz 710047668636097f7557ba45953fce1a Python-3.3.0b1.tar.xz