Merged revisions 55962-56019 via svnmerge from

svn+ssh://pythondev@svn.python.org/python/branches/p3yk

................
  r55985 | neal.norwitz | 2007-06-14 20:14:38 -0700 (Thu, 14 Jun 2007) | 2 lines

  All these tests have been flaky wrt reporting leaks.  Disable them.
................
  r56003 | neal.norwitz | 2007-06-15 19:41:09 -0700 (Fri, 15 Jun 2007) | 1 line

  Fix typo (certain).
................
  r56004 | neal.norwitz | 2007-06-15 20:54:18 -0700 (Fri, 15 Jun 2007) | 4 lines

  Fix it so test_os no longer reports ref leaks by clearing all the caches
  the ABCMeta stores on the class.  Apply this to all the ABC collections
  as well as the class of os.environ which inherits from an ABC collection.
................
  r56013 | neal.norwitz | 2007-06-17 19:56:31 -0700 (Sun, 17 Jun 2007) | 4 lines

  This should make it a little easier when adding new collections which use ABCs.
  The new subclass won't need to be listed in regrtest.
  It will be even better when Guido adds weakrefs. :-)
................
  r56014 | martin.v.loewis | 2007-06-17 20:15:51 -0700 (Sun, 17 Jun 2007) | 1 line

  Drop inline, as it's not support by VS 2003.
................
  r56015 | martin.v.loewis | 2007-06-17 20:17:19 -0700 (Sun, 17 Jun 2007) | 1 line

  Expect long objects for DWORD values.
................
  r56016 | martin.v.loewis | 2007-06-17 20:18:01 -0700 (Sun, 17 Jun 2007) | 1 line

  Drop modules that have been deleted.
................
  r56017 | martin.v.loewis | 2007-06-17 20:18:55 -0700 (Sun, 17 Jun 2007) | 1 line

  Bump DLL version number to 30.
................
  r56018 | neal.norwitz | 2007-06-17 20:55:43 -0700 (Sun, 17 Jun 2007) | 62 lines

  Merged revisions 55951-56013 via svnmerge from
  svn+ssh://pythondev@svn.python.org/python/trunk

  ........
    r55956 | thomas.heller | 2007-06-13 00:07:03 -0700 (Wed, 13 Jun 2007) | 2 lines

    Do not hardcode the buildbot's directory name.
  ........
    r55957 | thomas.heller | 2007-06-13 00:07:41 -0700 (Wed, 13 Jun 2007) | 2 lines

    Notes about building tcl/tk for windows/AMD64.
  ........
    r55958 | thomas.heller | 2007-06-13 00:54:57 -0700 (Wed, 13 Jun 2007) | 2 lines

    Build bzip2.
  ........
    r55962 | walter.doerwald | 2007-06-13 09:57:12 -0700 (Wed, 13 Jun 2007) | 8 lines

    Add T_PYSSIZET in structmember.h: This can be used for
    Py_ssize_t members.

    Simplify the implementation of UnicodeError objects:
    start and end attributes are now stored directly as
    Py_ssize_t members, which simplifies various get and
    set functions.
  ........
    r55975 | martin.v.loewis | 2007-06-14 13:46:25 -0700 (Thu, 14 Jun 2007) | 3 lines

    Patch #1734014: Use _I64_MAX instead of LLONG_MAX.
    Will backport to 2.5.
  ........
    r55984 | neal.norwitz | 2007-06-14 20:11:41 -0700 (Thu, 14 Jun 2007) | 4 lines

    urllib2_localnet says it leaks probably due to threads. So ignore it.
    popen2 is also complaining probably for similar reasons.
    make install always reports failure, so don't mail in this case.
  ........
    r56001 | andrew.kuchling | 2007-06-15 15:43:03 -0700 (Fri, 15 Jun 2007) | 1 line

    Add a word
  ........
    r56005 | martin.v.loewis | 2007-06-16 03:08:43 -0700 (Sat, 16 Jun 2007) | 2 lines

    Mention Senthil Kumaran.
  ........
    r56006 | georg.brandl | 2007-06-16 10:10:12 -0700 (Sat, 16 Jun 2007) | 2 lines

    Add missing \versionadded.
  ........
    r56009 | neal.norwitz | 2007-06-17 11:48:32 -0700 (Sun, 17 Jun 2007) | 1 line

    SF #1738670, make example in doc work
  ........
    r56011 | neal.norwitz | 2007-06-17 19:46:36 -0700 (Sun, 17 Jun 2007) | 1 line

    SF #1738754, remove extra backslash in string
  ........
    r56012 | neal.norwitz | 2007-06-17 19:50:15 -0700 (Sun, 17 Jun 2007) | 1 line

    Revert last change for SF #1738754, there's no print in there.
  ........
................
This commit is contained in:
Guido van Rossum 2007-06-18 17:58:50 +00:00
parent 96ca6916b4
commit 7eaf8223a0
18 changed files with 198 additions and 201 deletions

View File

@ -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}

View File

@ -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

View File

@ -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

View File

@ -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;

View File

@ -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

View File

@ -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.
"""

View File

@ -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()

View File

@ -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

View File

@ -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.

View File

@ -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
);
}

View File

@ -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);

View File

@ -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:

View File

@ -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},

View File

@ -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 */

View File

@ -39,15 +39,15 @@
<Tool
Name="VCLinkerTool"
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="1"/>
<Tool
Name="VCMIDLTool"/>
@ -99,15 +99,15 @@
<Tool
Name="VCLinkerTool"
AdditionalDependencies="getbuildinfo.o"
OutputFile="./python26_d.dll"
OutputFile="./python30_d.dll"
LinkIncremental="1"
SuppressStartupBanner="TRUE"
IgnoreDefaultLibraryNames="libc"
GenerateDebugInformation="TRUE"
ProgramDatabaseFile=".\./python26_d.pdb"
ProgramDatabaseFile=".\./python30_d.pdb"
SubSystem="2"
BaseAddress="0x1e000000"
ImportLibrary=".\./python26_d.lib"
ImportLibrary=".\./python30_d.lib"
TargetMachine="1"/>
<Tool
Name="VCMIDLTool"/>
@ -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"/>
<Tool
Name="VCMIDLTool"/>
@ -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"/>
<Tool
Name="VCMIDLTool"/>
@ -364,6 +364,9 @@
<File
RelativePath="..\Modules\_codecsmodule.c">
</File>
<File
RelativePath="..\Modules\_collectionsmodule.c">
</File>
<File
RelativePath="..\Modules\_csv.c">
</File>
@ -460,9 +463,6 @@
<File
RelativePath="..\Objects\codeobject.c">
</File>
<File
RelativePath="..\Modules\_collectionsmodule.c">
</File>
<File
RelativePath="..\Python\compile.c">
</File>

View File

@ -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);

View File

@ -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 ..\..

View File

@ -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