diff --git a/Doc/api/concrete.tex b/Doc/api/concrete.tex index 6dc1ca497e4..afba52fbec8 100644 --- a/Doc/api/concrete.tex +++ b/Doc/api/concrete.tex @@ -99,6 +99,7 @@ There is no \cfunction{PyNone_Check()} function for the same reason. \begin{csimplemacrodesc}{Py_RETURN_NONE} Properly handle returning \cdata{Py_None} from within a C function. + \versionadded{2.4} \end{csimplemacrodesc} diff --git a/Doc/howto/unicode.rst b/Doc/howto/unicode.rst index f92471a3edb..dffe2cb83ac 100644 --- a/Doc/howto/unicode.rst +++ b/Doc/howto/unicode.rst @@ -152,7 +152,7 @@ it presents a number of problems. 4. Many Internet standards are defined in terms of textual data, and can't handle content with embedded zero bytes. -Generally people don't use this encoding, choosing other encodings +Generally people don't use this encoding, instead choosing other encodings that are more efficient and convenient. Encodings don't have to handle every possible Unicode character, and diff --git a/Doc/lib/libsqlite3.tex b/Doc/lib/libsqlite3.tex index 19eed7e4604..a7a0e94266c 100644 --- a/Doc/lib/libsqlite3.tex +++ b/Doc/lib/libsqlite3.tex @@ -42,6 +42,12 @@ c.execute('''create table stocks # Insert a row of data c.execute("""insert into stocks values ('2006-01-05','BUY','RHAT',100,35.14)""") + +# Save (commit) the changes +conn.commit() + +# We can also close the cursor if we are done with it +c.close() \end{verbatim} Usually your SQL operations will need to use values from Python diff --git a/Include/pyerrors.h b/Include/pyerrors.h index 1eacbaff8f0..b494bb646bf 100644 --- a/Include/pyerrors.h +++ b/Include/pyerrors.h @@ -30,8 +30,8 @@ typedef struct { PyObject *args; PyObject *encoding; PyObject *object; - PyObject *start; - PyObject *end; + Py_ssize_t start; + Py_ssize_t end; PyObject *reason; } PyUnicodeErrorObject; diff --git a/Include/structmember.h b/Include/structmember.h index a35b7a78902..a46788dfaba 100644 --- a/Include/structmember.h +++ b/Include/structmember.h @@ -68,9 +68,10 @@ typedef struct PyMemberDef { #ifdef HAVE_LONG_LONG #define T_LONGLONG 17 #define T_ULONGLONG 18 +#define T_PYSSIZET 19 /* Py_ssize_t */ #endif /* HAVE_LONG_LONG */ -#define T_NONE 19 /* Value is always None */ +#define T_NONE 20 /* Value is always None */ /* Flags */ #define READONLY 1 diff --git a/Lib/_abcoll.py b/Lib/_abcoll.py index cd1c9ce6ffc..5fbb2190ea6 100644 --- a/Lib/_abcoll.py +++ b/Lib/_abcoll.py @@ -4,7 +4,7 @@ """Abstract Base Classes (ABCs) for collections, according to PEP 3119. DON'T USE THIS MODULE DIRECTLY! The classes here should be imported -via collections; they are defined here only to alleviate ceratin +via collections; they are defined here only to alleviate certain bootstrapping issues. Unit tests are in test_collections. """ diff --git a/Lib/test/regrtest.py b/Lib/test/regrtest.py index 5dfc9d484d2..8c4b5e5fc00 100755 --- a/Lib/test/regrtest.py +++ b/Lib/test/regrtest.py @@ -697,7 +697,7 @@ def dash_R_cleanup(fs, ps, pic): import gc, copy_reg import _strptime, linecache, dircache import urlparse, urllib, urllib2, mimetypes, doctest - import struct, filecmp, collections + import struct, filecmp, _abcoll from distutils.dir_util import _path_created # Restore some original values. @@ -708,8 +708,11 @@ def dash_R_cleanup(fs, ps, pic): sys.path_importer_cache.update(pic) # Clear ABC registries. - for obj in [collections.Hashable, collections.Iterable]: - obj._ABCMeta__registry.clear() + for abc in [getattr(_abcoll, a) for a in _abcoll.__all__]: + for obj in abc.__subclasses__() + [abc]: + obj._ABCMeta__registry.clear() + obj._ABCMeta__cache.clear() + obj._ABCMeta__negative_cache.clear() # Clear assorted module caches. _path_created.clear() diff --git a/Misc/build.sh b/Misc/build.sh index 779ba93860c..9ae63651307 100755 --- a/Misc/build.sh +++ b/Misc/build.sh @@ -67,7 +67,7 @@ REFLOG="build/reflog.txt.out" # Note: test_XXX (none currently) really leak, but are disabled # so we don't send spam. Any test which really leaks should only # be listed here if there are also test cases under Lib/test/leakers. -LEAKY_TESTS="test_(cmd_line|socket)" +LEAKY_TESTS="test_(cmd_line|popen2|socket|threading_local|urllib2_localnet)" # These tests always fail, so skip them so we don't get false positives. _ALWAYS_SKIP="" @@ -170,7 +170,6 @@ if [ $err = 0 -a "$BUILD_DISABLED" != "yes" ]; then start=`current_time` make install >& build/$F update_status "Installing" "$F" $start - mail_on_failure "install" build/$F if [ ! -x $PYTHON ]; then ln -s ${PYTHON}3.* $PYTHON diff --git a/Misc/developers.txt b/Misc/developers.txt index 3fc033fe9e3..ae85ef562be 100644 --- a/Misc/developers.txt +++ b/Misc/developers.txt @@ -17,6 +17,10 @@ the format to accommodate documentation needs as they arise. Permissions History ------------------- +- Senthil Kumaran was given SVN access on June 16 2007 + by MvL, for his Summer-of-Code project, mentored by + Skip Montanaro. + - Alexandre Vassalotti was given SVN access on May 21 2007 by MvL, for his Summer-of-Code project, mentored by Brett Cannon. diff --git a/Objects/exceptions.c b/Objects/exceptions.c index c9335ad8380..8d1ee2a6021 100644 --- a/Objects/exceptions.c +++ b/Objects/exceptions.c @@ -947,36 +947,6 @@ SimpleExtendsException(PyExc_Exception, ValueError, SimpleExtendsException(PyExc_ValueError, UnicodeError, "Unicode related error."); -static int -get_int(PyObject *attr, Py_ssize_t *value, const char *name) -{ - if (!attr) { - PyErr_Format(PyExc_TypeError, "%.200s attribute not set", name); - return -1; - } - - if (PyLong_Check(attr)) { - *value = PyLong_AsSsize_t(attr); - if (*value == -1 && PyErr_Occurred()) - return -1; - } else { - PyErr_Format(PyExc_TypeError, "%.200s attribute must be int", name); - return -1; - } - return 0; -} - -static int -set_ssize_t(PyObject **attr, Py_ssize_t value) -{ - PyObject *obj = PyInt_FromSsize_t(value); - if (!obj) - return -1; - Py_CLEAR(*attr); - *attr = obj; - return 0; -} - static PyObject * get_bytes(PyObject *attr, const char *name) { @@ -1054,40 +1024,37 @@ PyUnicodeTranslateError_GetObject(PyObject *exc) int PyUnicodeEncodeError_GetStart(PyObject *exc, Py_ssize_t *start) { - if (!get_int(((PyUnicodeErrorObject *)exc)->start, start, "start")) { - Py_ssize_t size; - PyObject *obj = get_unicode(((PyUnicodeErrorObject *)exc)->object, - "object"); - if (!obj) return -1; - size = PyUnicode_GET_SIZE(obj); - if (*start<0) - *start = 0; /*XXX check for values <0*/ - if (*start>=size) - *start = size-1; - Py_DECREF(obj); - return 0; - } - return -1; + Py_ssize_t size; + PyObject *obj = get_unicode(((PyUnicodeErrorObject *)exc)->object, + "object"); + if (!obj) + return -1; + *start = ((PyUnicodeErrorObject *)exc)->start; + size = PyUnicode_GET_SIZE(obj); + if (*start<0) + *start = 0; /*XXX check for values <0*/ + if (*start>=size) + *start = size-1; + Py_DECREF(obj); + return 0; } int PyUnicodeDecodeError_GetStart(PyObject *exc, Py_ssize_t *start) { - if (!get_int(((PyUnicodeErrorObject *)exc)->start, start, "start")) { - Py_ssize_t size; - PyObject *obj = get_bytes(((PyUnicodeErrorObject *)exc)->object, - "object"); - if (!obj) return -1; - size = PyBytes_GET_SIZE(obj); - if (*start<0) - *start = 0; - if (*start>=size) - *start = size-1; - Py_DECREF(obj); - return 0; - } - return -1; + Py_ssize_t size; + PyObject *obj = get_bytes(((PyUnicodeErrorObject *)exc)->object, "object"); + if (!obj) + return -1; + size = PyBytes_GET_SIZE(obj); + *start = ((PyUnicodeErrorObject *)exc)->start; + if (*start<0) + *start = 0; + if (*start>=size) + *start = size-1; + Py_DECREF(obj); + return 0; } @@ -1101,61 +1068,61 @@ PyUnicodeTranslateError_GetStart(PyObject *exc, Py_ssize_t *start) int PyUnicodeEncodeError_SetStart(PyObject *exc, Py_ssize_t start) { - return set_ssize_t(&((PyUnicodeErrorObject *)exc)->start, start); + ((PyUnicodeErrorObject *)exc)->start = start; + return 0; } int PyUnicodeDecodeError_SetStart(PyObject *exc, Py_ssize_t start) { - return set_ssize_t(&((PyUnicodeErrorObject *)exc)->start, start); + ((PyUnicodeErrorObject *)exc)->start = start; + return 0; } int PyUnicodeTranslateError_SetStart(PyObject *exc, Py_ssize_t start) { - return set_ssize_t(&((PyUnicodeErrorObject *)exc)->start, start); + ((PyUnicodeErrorObject *)exc)->start = start; + return 0; } int PyUnicodeEncodeError_GetEnd(PyObject *exc, Py_ssize_t *end) { - if (!get_int(((PyUnicodeErrorObject *)exc)->end, end, "end")) { - Py_ssize_t size; - PyObject *obj = get_unicode(((PyUnicodeErrorObject *)exc)->object, - "object"); - if (!obj) return -1; - size = PyUnicode_GET_SIZE(obj); - if (*end<1) - *end = 1; - if (*end>size) - *end = size; - Py_DECREF(obj); - return 0; - } - return -1; + Py_ssize_t size; + PyObject *obj = get_unicode(((PyUnicodeErrorObject *)exc)->object, + "object"); + if (!obj) + return -1; + *end = ((PyUnicodeErrorObject *)exc)->end; + size = PyUnicode_GET_SIZE(obj); + if (*end<1) + *end = 1; + if (*end>size) + *end = size; + Py_DECREF(obj); + return 0; } int PyUnicodeDecodeError_GetEnd(PyObject *exc, Py_ssize_t *end) { - if (!get_int(((PyUnicodeErrorObject *)exc)->end, end, "end")) { - Py_ssize_t size; - PyObject *obj = get_bytes(((PyUnicodeErrorObject *)exc)->object, - "object"); - if (!obj) return -1; - size = PyBytes_GET_SIZE(obj); - if (*end<1) - *end = 1; - if (*end>size) - *end = size; - Py_DECREF(obj); - return 0; - } - return -1; + Py_ssize_t size; + PyObject *obj = get_bytes(((PyUnicodeErrorObject *)exc)->object, "object"); + if (!obj) + return -1; + size = PyBytes_GET_SIZE(obj); + *end = ((PyUnicodeErrorObject *)exc)->end; + if (*end<1) + *end = 1; + if (*end>size) + *end = size; + Py_DECREF(obj); + return 0; } @@ -1169,21 +1136,24 @@ PyUnicodeTranslateError_GetEnd(PyObject *exc, Py_ssize_t *start) int PyUnicodeEncodeError_SetEnd(PyObject *exc, Py_ssize_t end) { - return set_ssize_t(&((PyUnicodeErrorObject *)exc)->end, end); + ((PyUnicodeErrorObject *)exc)->end = end; + return 0; } int PyUnicodeDecodeError_SetEnd(PyObject *exc, Py_ssize_t end) { - return set_ssize_t(&((PyUnicodeErrorObject *)exc)->end, end); + ((PyUnicodeErrorObject *)exc)->end = end; + return 0; } int PyUnicodeTranslateError_SetEnd(PyObject *exc, Py_ssize_t end) { - return set_ssize_t(&((PyUnicodeErrorObject *)exc)->end, end); + ((PyUnicodeErrorObject *)exc)->end = end; + return 0; } PyObject * @@ -1237,25 +1207,20 @@ UnicodeError_init(PyUnicodeErrorObject *self, PyObject *args, PyObject *kwds, { Py_CLEAR(self->encoding); Py_CLEAR(self->object); - Py_CLEAR(self->start); - Py_CLEAR(self->end); Py_CLEAR(self->reason); - if (!PyArg_ParseTuple(args, "O!O!O!O!O!", + if (!PyArg_ParseTuple(args, "O!O!nnO!", &PyUnicode_Type, &self->encoding, objecttype, &self->object, - &PyLong_Type, &self->start, - &PyLong_Type, &self->end, + &self->start, + &self->end, &PyUnicode_Type, &self->reason)) { - self->encoding = self->object = self->start = self->end = - self->reason = NULL; + self->encoding = self->object = self->reason = NULL; return -1; } Py_INCREF(self->encoding); Py_INCREF(self->object); - Py_INCREF(self->start); - Py_INCREF(self->end); Py_INCREF(self->reason); return 0; @@ -1266,8 +1231,6 @@ UnicodeError_clear(PyUnicodeErrorObject *self) { Py_CLEAR(self->encoding); Py_CLEAR(self->object); - Py_CLEAR(self->start); - Py_CLEAR(self->end); Py_CLEAR(self->reason); return BaseException_clear((PyBaseExceptionObject *)self); } @@ -1285,8 +1248,6 @@ UnicodeError_traverse(PyUnicodeErrorObject *self, visitproc visit, void *arg) { Py_VISIT(self->encoding); Py_VISIT(self->object); - Py_VISIT(self->start); - Py_VISIT(self->end); Py_VISIT(self->reason); return BaseException_traverse((PyBaseExceptionObject *)self, visit, arg); } @@ -1296,9 +1257,9 @@ static PyMemberDef UnicodeError_members[] = { PyDoc_STR("exception encoding")}, {"object", T_OBJECT, offsetof(PyUnicodeErrorObject, object), 0, PyDoc_STR("exception object")}, - {"start", T_OBJECT, offsetof(PyUnicodeErrorObject, start), 0, + {"start", T_PYSSIZET, offsetof(PyUnicodeErrorObject, start), 0, PyDoc_STR("exception start")}, - {"end", T_OBJECT, offsetof(PyUnicodeErrorObject, end), 0, + {"end", T_PYSSIZET, offsetof(PyUnicodeErrorObject, end), 0, PyDoc_STR("exception end")}, {"reason", T_OBJECT, offsetof(PyUnicodeErrorObject, reason), 0, PyDoc_STR("exception reason")}, @@ -1322,17 +1283,10 @@ UnicodeEncodeError_init(PyObject *self, PyObject *args, PyObject *kwds) static PyObject * UnicodeEncodeError_str(PyObject *self) { - Py_ssize_t start; - Py_ssize_t end; + PyUnicodeErrorObject *uself = (PyUnicodeErrorObject *)self; - if (PyUnicodeEncodeError_GetStart(self, &start)) - return NULL; - - if (PyUnicodeEncodeError_GetEnd(self, &end)) - return NULL; - - if (end==start+1) { - int badchar = (int)PyUnicode_AS_UNICODE(((PyUnicodeErrorObject *)self)->object)[start]; + if (uself->end==uself->start+1) { + int badchar = (int)PyUnicode_AS_UNICODE(uself->object)[uself->start]; const char *fmt; if (badchar <= 0xff) fmt = "'%U' codec can't encode character u'\\x%02x' in position %zd: %U"; @@ -1344,15 +1298,15 @@ UnicodeEncodeError_str(PyObject *self) fmt, ((PyUnicodeErrorObject *)self)->encoding, badchar, - start, + uself->start, ((PyUnicodeErrorObject *)self)->reason ); } return PyUnicode_FromFormat( "'%U' codec can't encode characters in position %zd-%zd: %U", ((PyUnicodeErrorObject *)self)->encoding, - start, - (end-1), + uself->start, + uself->end-1, ((PyUnicodeErrorObject *)self)->reason ); } @@ -1398,30 +1352,23 @@ UnicodeDecodeError_init(PyObject *self, PyObject *args, PyObject *kwds) static PyObject * UnicodeDecodeError_str(PyObject *self) { - Py_ssize_t start = 0; - Py_ssize_t end = 0; + PyUnicodeErrorObject *uself = (PyUnicodeErrorObject *)self; - if (PyUnicodeDecodeError_GetStart(self, &start)) - return NULL; - - if (PyUnicodeDecodeError_GetEnd(self, &end)) - return NULL; - - if (end==start+1) { - int byte = (int)(PyBytes_AS_STRING(((PyUnicodeErrorObject *)self)->object)[start]&0xff); + if (uself->end==uself->start+1) { + int byte = (int)(PyBytes_AS_STRING(((PyUnicodeErrorObject *)self)->object)[uself->start]&0xff); return PyUnicode_FromFormat( "'%U' codec can't decode byte 0x%02x in position %zd: %U", ((PyUnicodeErrorObject *)self)->encoding, byte, - start, + uself->start, ((PyUnicodeErrorObject *)self)->reason ); } return PyUnicode_FromFormat( "'%U' codec can't decode bytes in position %zd-%zd: %U", ((PyUnicodeErrorObject *)self)->encoding, - start, - (end-1), + uself->start, + uself->end-1, ((PyUnicodeErrorObject *)self)->reason ); } @@ -1466,22 +1413,18 @@ UnicodeTranslateError_init(PyUnicodeErrorObject *self, PyObject *args, return -1; Py_CLEAR(self->object); - Py_CLEAR(self->start); - Py_CLEAR(self->end); Py_CLEAR(self->reason); - if (!PyArg_ParseTuple(args, "O!O!O!O!", + if (!PyArg_ParseTuple(args, "O!nnO!", &PyUnicode_Type, &self->object, - &PyLong_Type, &self->start, - &PyLong_Type, &self->end, + &self->start, + &self->end, &PyUnicode_Type, &self->reason)) { - self->object = self->start = self->end = self->reason = NULL; + self->object = self->reason = NULL; return -1; } Py_INCREF(self->object); - Py_INCREF(self->start); - Py_INCREF(self->end); Py_INCREF(self->reason); return 0; @@ -1491,17 +1434,10 @@ UnicodeTranslateError_init(PyUnicodeErrorObject *self, PyObject *args, static PyObject * UnicodeTranslateError_str(PyObject *self) { - Py_ssize_t start; - Py_ssize_t end; + PyUnicodeErrorObject *uself = (PyUnicodeErrorObject *)self; - if (PyUnicodeTranslateError_GetStart(self, &start)) - return NULL; - - if (PyUnicodeTranslateError_GetEnd(self, &end)) - return NULL; - - if (end==start+1) { - int badchar = (int)PyUnicode_AS_UNICODE(((PyUnicodeErrorObject *)self)->object)[start]; + if (uself->end==uself->start+1) { + int badchar = (int)PyUnicode_AS_UNICODE(uself->object)[uself->start]; const char *fmt; if (badchar <= 0xff) fmt = "can't translate character u'\\x%02x' in position %zd: %U"; @@ -1512,15 +1448,15 @@ UnicodeTranslateError_str(PyObject *self) return PyUnicode_FromFormat( fmt, badchar, - start, - ((PyUnicodeErrorObject *)self)->reason + uself->start, + uself->reason ); } return PyUnicode_FromFormat( "can't translate characters in position %zd-%zd: %U", - start, - (end-1), - ((PyUnicodeErrorObject *)self)->reason + uself->start, + uself->end-1, + uself->reason ); } diff --git a/Objects/longobject.c b/Objects/longobject.c index 1f568d8eac4..bfef437cdad 100644 --- a/Objects/longobject.c +++ b/Objects/longobject.c @@ -24,7 +24,7 @@ static PyLongObject small_ints[NSMALLNEGINTS + NSMALLPOSINTS]; int quick_int_allocs, quick_neg_int_allocs; #endif -static inline PyObject * +static PyObject * get_small_int(int ival) { PyObject *v = (PyObject*)(small_ints + ival + NSMALLNEGINTS); diff --git a/PC/_winreg.c b/PC/_winreg.c index ffaaaee5003..f1d4c9df92c 100644 --- a/PC/_winreg.c +++ b/PC/_winreg.c @@ -693,9 +693,10 @@ static BOOL Py2Reg(PyObject *value, DWORD typ, BYTE **retDataBuf, DWORD *retDataSize) { int i,j; + DWORD d; switch (typ) { case REG_DWORD: - if (value != Py_None && !PyInt_Check(value)) + if (value != Py_None && !PyLong_Check(value)) return FALSE; *retDataBuf = (BYTE *)PyMem_NEW(DWORD, 1); if (*retDataBuf==NULL){ @@ -707,10 +708,10 @@ Py2Reg(PyObject *value, DWORD typ, BYTE **retDataBuf, DWORD *retDataSize) DWORD zero = 0; memcpy(*retDataBuf, &zero, sizeof(DWORD)); } - else - memcpy(*retDataBuf, - &PyInt_AS_LONG((PyIntObject *)value), - sizeof(DWORD)); + else { + d = PyLong_AsLong(value); + memcpy(*retDataBuf, &d, sizeof(DWORD)); + } break; case REG_SZ: case REG_EXPAND_SZ: diff --git a/PC/config.c b/PC/config.c index 30ae456b386..8ca8cef00b0 100644 --- a/PC/config.c +++ b/PC/config.c @@ -14,11 +14,9 @@ extern void initcmath(void); extern void initerrno(void); extern void initgc(void); extern void initmath(void); -extern void init_md5(void); extern void initnt(void); extern void initoperator(void); extern void initsignal(void); -extern void init_sha(void); extern void init_sha256(void); extern void init_sha512(void); extern void inittime(void); @@ -61,7 +59,6 @@ extern void init_subprocess(void); extern void init_lsprof(void); extern void init_ast(void); extern void init_types(void); -extern void initatexit(void); /* tools/freeze/makeconfig.py marker for additional "extern" */ /* -- ADDMODULE MARKER 1 -- */ @@ -73,7 +70,6 @@ struct _inittab _PyImport_Inittab[] = { {"array", initarray}, {"_ast", init_ast}, - {"atexit", initatexit}, #ifdef MS_WINDOWS #ifndef MS_WINI64 {"audioop", initaudioop}, @@ -84,11 +80,9 @@ struct _inittab _PyImport_Inittab[] = { {"errno", initerrno}, {"gc", initgc}, {"math", initmath}, - {"_md5", init_md5}, {"nt", initnt}, /* Use the NT os functions, not posix */ {"operator", initoperator}, {"signal", initsignal}, - {"_sha", init_sha}, {"_sha256", init_sha256}, {"_sha512", init_sha512}, {"time", inittime}, diff --git a/PC/pyconfig.h b/PC/pyconfig.h index fed87754a29..5b662cef01f 100644 --- a/PC/pyconfig.h +++ b/PC/pyconfig.h @@ -275,9 +275,9 @@ typedef int pid_t; #define HAVE_LONG_LONG 1 #ifndef PY_LONG_LONG # define PY_LONG_LONG __int64 -# define PY_LLONG_MAX LLONG_MAX -# define PY_LLONG_MIN LLONG_MIN -# define PY_ULLONG_MAX ULLONG_MAX +# define PY_LLONG_MAX _I64_MAX +# define PY_LLONG_MIN _I64_MIN +# define PY_ULLONG_MAX _UI64_MAX #endif /* For Windows the Python core is in a DLL by default. Test @@ -303,9 +303,9 @@ Py_NO_ENABLE_SHARED to find out. Also support MS_NO_COREDLL for b/w compat */ their Makefile (other compilers are generally taken care of by distutils.) */ # ifdef _DEBUG -# pragma comment(lib,"python26_d.lib") +# pragma comment(lib,"python30_d.lib") # else -# pragma comment(lib,"python26.lib") +# pragma comment(lib,"python30.lib") # endif /* _DEBUG */ # endif /* _MSC_VER */ # endif /* Py_BUILD_CORE */ diff --git a/PCbuild/pythoncore.vcproj b/PCbuild/pythoncore.vcproj index b63f61237ee..2de1611f987 100644 --- a/PCbuild/pythoncore.vcproj +++ b/PCbuild/pythoncore.vcproj @@ -39,15 +39,15 @@ @@ -99,15 +99,15 @@ @@ -166,15 +166,15 @@ Name="VCLinkerTool" AdditionalOptions=" /MACHINE:IA64 /USELINK:MS_SDK" AdditionalDependencies="getbuildinfo.o" - OutputFile="./python26.dll" + OutputFile="./python30.dll" LinkIncremental="1" SuppressStartupBanner="FALSE" IgnoreDefaultLibraryNames="libc" GenerateDebugInformation="TRUE" - ProgramDatabaseFile=".\./python26.pdb" + ProgramDatabaseFile=".\./python30.pdb" SubSystem="2" BaseAddress="0x1e000000" - ImportLibrary=".\./python26.lib" + ImportLibrary=".\./python30.lib" TargetMachine="0"/> @@ -233,15 +233,15 @@ Name="VCLinkerTool" AdditionalOptions=" /MACHINE:AMD64 /USELINK:MS_SDK" AdditionalDependencies="getbuildinfo.o" - OutputFile="./python26.dll" + OutputFile="./python30.dll" LinkIncremental="1" SuppressStartupBanner="TRUE" IgnoreDefaultLibraryNames="libc" GenerateDebugInformation="TRUE" - ProgramDatabaseFile=".\./python26.pdb" + ProgramDatabaseFile=".\./python30.pdb" SubSystem="2" BaseAddress="0x1e000000" - ImportLibrary=".\./python26.lib" + ImportLibrary=".\./python30.lib" TargetMachine="0"/> @@ -364,6 +364,9 @@ + + @@ -460,9 +463,6 @@ - - diff --git a/Python/structmember.c b/Python/structmember.c index 1de223850c8..5165a99432f 100644 --- a/Python/structmember.c +++ b/Python/structmember.c @@ -81,6 +81,9 @@ PyMember_GetOne(const char *addr, PyMemberDef *l) case T_ULONG: v = PyLong_FromUnsignedLong(*(unsigned long*)addr); break; + case T_PYSSIZET: + v = PyInt_FromSsize_t(*(Py_ssize_t*)addr); + break; case T_FLOAT: v = PyFloat_FromDouble((double)*(float*)addr); break; @@ -259,6 +262,13 @@ PyMember_SetOne(char *addr, PyMemberDef *l, PyObject *v) } break; } + case T_PYSSIZET:{ + *(Py_ssize_t*)addr = PyInt_AsSsize_t(v); + if ((*(Py_ssize_t*)addr == (Py_ssize_t)-1) + && PyErr_Occurred()) + return -1; + break; + } case T_FLOAT:{ double double_val; double_val = PyFloat_AsDouble(v); diff --git a/Tools/buildbot/README.tcltk-AMD64 b/Tools/buildbot/README.tcltk-AMD64 new file mode 100644 index 00000000000..edc89eba9e6 --- /dev/null +++ b/Tools/buildbot/README.tcltk-AMD64 @@ -0,0 +1,36 @@ +Comments on building tcl/tk for AMD64 with the MS SDK compiler +============================================================== + +I did have to build tcl/tk manually. + +First, I had to build the nmakehlp.exe helper utility manually by executing + cl nmakehlp.c /link bufferoverflowU.lib +in both the tcl8.4.12\win and tk8.4.12\win directories. + +Second, the AMD64 compiler refuses to compile the file +tcl8.4.12\generic\tclExecute.c because it insists on using intrinsics +for the 'ceil' and 'floor' functions: + + ..\generic\tclExecute.c(394) : error C2099: initializer is not a constant + ..\generic\tclExecute.c(398) : error C2099: initializer is not a constant + +I did comment out these lines; an alternative would have been to use +the /Oi- compiler flag to disable the intrinsic functions. +The commands then used were these: + + svn export http://svn.python.org/projects/external/tcl8.4.12 + cd tcl8.4.12\win + REM + echo patch the tcl8.4.12\generic\tclExecute.c file + pause + REM + cl nmakehlp.c /link bufferoverflowU.lib + nmake -f makefile.vc MACHINE=AMD64 + nmake -f makefile.vc INSTALLDIR=..\..\tcltk install + cd ..\.. + svn export http://svn.python.org/projects/external/tk8.4.12 + cd tk8.4.12\win + cl nmakehlp.c /link bufferoverflowU.lib + nmake -f makefile.vc TCLDIR=..\..\tcl8.4.12 MACHINE=AMD64 + nmake -f makefile.vc TCLDIR=..\..\tcl8.4.12 INSTALLDIR=..\..\tcltk install + cd ..\.. diff --git a/Tools/buildbot/external-amd64.bat b/Tools/buildbot/external-amd64.bat index dac8cb3df83..ec9e6b62145 100644 --- a/Tools/buildbot/external-amd64.bat +++ b/Tools/buildbot/external-amd64.bat @@ -7,23 +7,29 @@ call "%VS71COMNTOOLS%vsvars32.bat" call "%MSSdk%\SetEnv" /XP64 /RETAIL @rem Assume we start inside the Python source directory +for %%i in (.) do set CWD=%%~fi cd .. @rem sqlite if not exist sqlite-source-3.3.4 ( svn export http://svn.python.org/projects/external/sqlite-source-3.3.4 - if exist build\PCbuild\sqlite3.dll del build\PCbuild\sqlite3.dll + if exist %CWD%\PCbuild\sqlite3.dll del %CWD%\PCbuild\sqlite3.dll ) -if not exist build\PCbuild\sqlite3.dll ( +if not exist %CWD%\PCbuild\sqlite3.dll ( cd sqlite-source-3.3.4\amd64 cl ..\*.c link /def:..\sqlite3.def /dll *.obj /out:sqlite3.dll bufferoverflowU.lib cd ..\.. - copy sqlite-source-3.3.4\amd64\sqlite3.dll build\PCbuild + copy sqlite-source-3.3.4\amd64\sqlite3.dll %CWD%\PCbuild ) @rem bzip if not exist bzip2-1.0.3 svn export http://svn.python.org/projects/external/bzip2-1.0.3 +if not exist bzip2-1.0.3\libbz2.lib ( + cd bzip2-1.0.3 + nmake /f makefile.msc CFLAGS="-DWIN32 -MD -Ox -D_FILE_OFFSET_BITS=64 -nologo /GS-" + cd .. +) @rem Sleepycat db if not exist db-4.4.20 svn export http://svn.python.org/projects/external/db-4.4.20