Merged revisions 76052,76522,76591,76689,76697,76733 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk ........ r76052 | gregory.p.smith | 2009-11-01 20:02:38 -0600 (Sun, 01 Nov 2009) | 5 lines see issue1006238, this merges in the following patch to ease cross compiling the printf %zd check. http://sources.gentoo.org/viewcvs.py/gentoo-x86/dev-lang/python/files/python-2.5-cross-printf.patch?rev=1.1&view=markup ........ r76522 | barry.warsaw | 2009-11-25 12:38:32 -0600 (Wed, 25 Nov 2009) | 2 lines Add mktime_tz to __all__. It's documented as being available in email.utils. ........ r76591 | benjamin.peterson | 2009-11-29 16:26:26 -0600 (Sun, 29 Nov 2009) | 4 lines now that deepcopy can handle instance methods, this hack can be removed #7409 Thanks Robert Collins ........ r76689 | benjamin.peterson | 2009-12-06 11:37:48 -0600 (Sun, 06 Dec 2009) | 1 line rewrite translate_newlines for clarity ........ r76697 | benjamin.peterson | 2009-12-06 15:24:30 -0600 (Sun, 06 Dec 2009) | 2 lines fix test_parser from tokenizer tweak ........ r76733 | benjamin.peterson | 2009-12-09 21:37:59 -0600 (Wed, 09 Dec 2009) | 1 line substitute PyDict_Check() for PyObject_IsInstance ........
This commit is contained in:
parent
0496c9ee0a
commit
8f326b2369
|
@ -208,7 +208,7 @@ class RoundtripLegalSyntaxTestCase(unittest.TestCase):
|
||||||
def test_position(self):
|
def test_position(self):
|
||||||
# An absolutely minimal test of position information. Better
|
# An absolutely minimal test of position information. Better
|
||||||
# tests would be a big project.
|
# tests would be a big project.
|
||||||
code = "def f(x):\n return x + 1\n"
|
code = "def f(x):\n return x + 1"
|
||||||
st1 = parser.suite(code)
|
st1 = parser.suite(code)
|
||||||
st2 = st1.totuple(line_info=1, col_info=1)
|
st2 = st1.totuple(line_info=1, col_info=1)
|
||||||
|
|
||||||
|
@ -237,9 +237,9 @@ class RoundtripLegalSyntaxTestCase(unittest.TestCase):
|
||||||
(14, '+', 2, 13),
|
(14, '+', 2, 13),
|
||||||
(2, '1', 2, 15),
|
(2, '1', 2, 15),
|
||||||
(4, '', 2, 16),
|
(4, '', 2, 16),
|
||||||
(6, '', 3, -1),
|
(6, '', 2, -1),
|
||||||
(4, '', 3, -1),
|
(4, '', 2, -1),
|
||||||
(0, '', 3, -1)],
|
(0, '', 2, -1)],
|
||||||
terminals)
|
terminals)
|
||||||
|
|
||||||
def test_extended_unpacking(self):
|
def test_extended_unpacking(self):
|
||||||
|
|
|
@ -130,17 +130,6 @@ class _AssertRaisesContext(object):
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
class _AssertWrapper(object):
|
|
||||||
"""Wrap entries in the _type_equality_funcs registry to make them deep
|
|
||||||
copyable."""
|
|
||||||
|
|
||||||
def __init__(self, function):
|
|
||||||
self.function = function
|
|
||||||
|
|
||||||
def __deepcopy__(self, memo):
|
|
||||||
memo[id(self)] = self
|
|
||||||
|
|
||||||
|
|
||||||
class TestCase(object):
|
class TestCase(object):
|
||||||
"""A class whose instances are single test cases.
|
"""A class whose instances are single test cases.
|
||||||
|
|
||||||
|
@ -214,7 +203,7 @@ class TestCase(object):
|
||||||
msg= argument that raises self.failureException with a
|
msg= argument that raises self.failureException with a
|
||||||
useful error message when the two arguments are not equal.
|
useful error message when the two arguments are not equal.
|
||||||
"""
|
"""
|
||||||
self._type_equality_funcs[typeobj] = _AssertWrapper(function)
|
self._type_equality_funcs[typeobj] = function
|
||||||
|
|
||||||
def addCleanup(self, function, *args, **kwargs):
|
def addCleanup(self, function, *args, **kwargs):
|
||||||
"""Add a function, with arguments, to be called when the test is
|
"""Add a function, with arguments, to be called when the test is
|
||||||
|
@ -437,7 +426,7 @@ class TestCase(object):
|
||||||
if type(first) is type(second):
|
if type(first) is type(second):
|
||||||
asserter = self._type_equality_funcs.get(type(first))
|
asserter = self._type_equality_funcs.get(type(first))
|
||||||
if asserter is not None:
|
if asserter is not None:
|
||||||
return asserter.function
|
return asserter
|
||||||
|
|
||||||
return self._baseAssertEqual
|
return self._baseAssertEqual
|
||||||
|
|
||||||
|
|
|
@ -1453,7 +1453,7 @@ PyNumber_ToBase(PyObject *n, int base)
|
||||||
int
|
int
|
||||||
PySequence_Check(PyObject *s)
|
PySequence_Check(PyObject *s)
|
||||||
{
|
{
|
||||||
if (PyObject_IsInstance(s, (PyObject *)&PyDict_Type))
|
if (PyDict_Check(s))
|
||||||
return 0;
|
return 0;
|
||||||
return s != NULL && s->ob_type->tp_as_sequence &&
|
return s != NULL && s->ob_type->tp_as_sequence &&
|
||||||
s->ob_type->tp_as_sequence->sq_item != NULL;
|
s->ob_type->tp_as_sequence->sq_item != NULL;
|
||||||
|
|
|
@ -652,20 +652,20 @@ translate_into_utf8(const char* str, const char* enc) {
|
||||||
|
|
||||||
static char *
|
static char *
|
||||||
translate_newlines(const char *s, int exec_input, struct tok_state *tok) {
|
translate_newlines(const char *s, int exec_input, struct tok_state *tok) {
|
||||||
int skip_next_lf = 0, length = strlen(s), final_length;
|
int skip_next_lf = 0, needed_length = strlen(s) + 2, final_length;
|
||||||
char *buf, *current;
|
char *buf, *current;
|
||||||
char c;
|
char c = '\0';
|
||||||
buf = PyMem_MALLOC(length + 2);
|
buf = PyMem_MALLOC(needed_length);
|
||||||
if (buf == NULL) {
|
if (buf == NULL) {
|
||||||
tok->done = E_NOMEM;
|
tok->done = E_NOMEM;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
for (current = buf; (c = *s++);) {
|
for (current = buf; *s; s++, current++) {
|
||||||
|
c = *s;
|
||||||
if (skip_next_lf) {
|
if (skip_next_lf) {
|
||||||
skip_next_lf = 0;
|
skip_next_lf = 0;
|
||||||
if (c == '\n') {
|
if (c == '\n') {
|
||||||
c = *s;
|
c = *++s;
|
||||||
s++;
|
|
||||||
if (!c)
|
if (!c)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -675,19 +675,18 @@ translate_newlines(const char *s, int exec_input, struct tok_state *tok) {
|
||||||
c = '\n';
|
c = '\n';
|
||||||
}
|
}
|
||||||
*current = c;
|
*current = c;
|
||||||
current++;
|
|
||||||
}
|
}
|
||||||
/* If this is exec input, add a newline to the end of the file if
|
/* If this is exec input, add a newline to the end of the string if
|
||||||
there isn't one already. */
|
there isn't one already. */
|
||||||
if (exec_input && *current != '\n') {
|
if (exec_input && c != '\n') {
|
||||||
*current = '\n';
|
*current = '\n';
|
||||||
current++;
|
current++;
|
||||||
}
|
}
|
||||||
*current = '\0';
|
*current = '\0';
|
||||||
final_length = current - buf;
|
final_length = current - buf + 1;
|
||||||
if (final_length < length && final_length)
|
if (final_length < needed_length && final_length)
|
||||||
/* should never fail */
|
/* should never fail */
|
||||||
buf = PyMem_REALLOC(buf, final_length + 1);
|
buf = PyMem_REALLOC(buf, final_length);
|
||||||
return buf;
|
return buf;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#! /bin/sh
|
#! /bin/sh
|
||||||
# From configure.in Revision: 76637 .
|
# From configure.in Revision: 76645 .
|
||||||
# Guess values for system-dependent variables and create Makefiles.
|
# Guess values for system-dependent variables and create Makefiles.
|
||||||
# Generated by GNU Autoconf 2.61 for python 3.2.
|
# Generated by GNU Autoconf 2.61 for python 3.2.
|
||||||
#
|
#
|
||||||
|
@ -26672,7 +26672,8 @@ if test "${ac_cv_have_size_t_format+set}" = set; then
|
||||||
echo $ECHO_N "(cached) $ECHO_C" >&6
|
echo $ECHO_N "(cached) $ECHO_C" >&6
|
||||||
else
|
else
|
||||||
if test "$cross_compiling" = yes; then
|
if test "$cross_compiling" = yes; then
|
||||||
ac_cv_have_size_t_format=no
|
ac_cv_have_size_t_format="cross -- assuming yes"
|
||||||
|
|
||||||
else
|
else
|
||||||
cat >conftest.$ac_ext <<_ACEOF
|
cat >conftest.$ac_ext <<_ACEOF
|
||||||
/* confdefs.h. */
|
/* confdefs.h. */
|
||||||
|
@ -26750,13 +26751,10 @@ rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$a
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
{ echo "$as_me:$LINENO: result: $ac_cv_have_size_t_format" >&5
|
{ echo "$as_me:$LINENO: result: $ac_cv_have_size_t_format" >&5
|
||||||
echo "${ECHO_T}$ac_cv_have_size_t_format" >&6; }
|
echo "${ECHO_T}$ac_cv_have_size_t_format" >&6; }
|
||||||
if test $ac_cv_have_size_t_format = yes
|
if test "$ac_cv_have_size_t_format" != no ; then
|
||||||
then
|
|
||||||
|
|
||||||
cat >>confdefs.h <<\_ACEOF
|
cat >>confdefs.h <<\_ACEOF
|
||||||
#define PY_FORMAT_SIZE_T "z"
|
#define PY_FORMAT_SIZE_T "z"
|
||||||
|
|
15
configure.in
15
configure.in
|
@ -3905,9 +3905,8 @@ then
|
||||||
LIBS="$LIBS -framework CoreFoundation"
|
LIBS="$LIBS -framework CoreFoundation"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
AC_MSG_CHECKING(for %zd printf() format support)
|
AC_CACHE_CHECK([for %zd printf() format support], ac_cv_have_size_t_format, [dnl
|
||||||
AC_CACHE_VAL(ac_cv_have_size_t_format,
|
AC_TRY_RUN([
|
||||||
AC_TRY_RUN([[
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
@ -3942,13 +3941,11 @@ int main()
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
]], ac_cv_have_size_t_format=yes,
|
], ac_cv_have_size_t_format=yes,
|
||||||
ac_cv_have_size_t_format=no,
|
ac_cv_have_size_t_format=no,
|
||||||
ac_cv_have_size_t_format=no)
|
[ac_cv_have_size_t_format="cross -- assuming yes"]
|
||||||
)
|
)])
|
||||||
AC_MSG_RESULT($ac_cv_have_size_t_format)
|
if test "$ac_cv_have_size_t_format" != no ; then
|
||||||
if test $ac_cv_have_size_t_format = yes
|
|
||||||
then
|
|
||||||
AC_DEFINE(PY_FORMAT_SIZE_T, "z",
|
AC_DEFINE(PY_FORMAT_SIZE_T, "z",
|
||||||
[Define to printf format modifier for Py_ssize_t])
|
[Define to printf format modifier for Py_ssize_t])
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Reference in New Issue