Merged revisions 64119,64147,64150,64165,64219-64221,64229-64230,64233,64235,64253,64278,64280,64301,64303,64320,64328,64338-64339 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk ........ r64119 | andrew.kuchling | 2008-06-11 14:53:14 +0200 (mer., 11 juin 2008) | 1 line Note PEP 371 section ........ r64147 | benjamin.peterson | 2008-06-11 22:04:30 +0200 (mer., 11 juin 2008) | 2 lines update ACKS and NEWs for multiprocessing ........ r64150 | georg.brandl | 2008-06-11 22:28:06 +0200 (mer., 11 juin 2008) | 2 lines Can we agree to put dots at entry ends? Thanks. ........ r64165 | armin.rigo | 2008-06-12 11:50:58 +0200 (jeu., 12 juin 2008) | 3 lines Sounds obvious, but I didn't even realize that you can put non-string keys in type dictionaries without using this locals() hack. ........ r64219 | neal.norwitz | 2008-06-13 08:00:46 +0200 (ven., 13 juin 2008) | 1 line Check for memory alloc failure ........ r64220 | neal.norwitz | 2008-06-13 08:02:26 +0200 (ven., 13 juin 2008) | 3 lines Fix some memory dealloc problems when exceptions occur. It caused: "Fatal Python error: UNREF invalid object" in the DoubleTest. ........ r64221 | neal.norwitz | 2008-06-13 08:03:25 +0200 (ven., 13 juin 2008) | 3 lines Fix typo in method name. The LT class implemented less than. The LE class should implement less than or equal to (as the code does). ........ r64229 | georg.brandl | 2008-06-13 15:26:54 +0200 (ven., 13 juin 2008) | 2 lines Clarification. ........ r64230 | robert.schuppenies | 2008-06-13 15:29:37 +0200 (ven., 13 juin 2008) | 2 lines Fixed: sys.getsizeof does not take the actual length of the tuples into account. ........ r64233 | benjamin.peterson | 2008-06-13 17:11:50 +0200 (ven., 13 juin 2008) | 2 lines platform.uname now tries to fill empty values even when os.uname is present ........ r64235 | benjamin.peterson | 2008-06-13 17:41:09 +0200 (ven., 13 juin 2008) | 1 line set svn:ignore on multiprocessing ........ r64253 | andrew.kuchling | 2008-06-13 21:38:18 +0200 (ven., 13 juin 2008) | 1 line Typo fixes ........ r64278 | martin.v.loewis | 2008-06-14 16:24:47 +0200 (sam., 14 juin 2008) | 2 lines Disable UAC by default. ........ r64280 | gregory.p.smith | 2008-06-14 19:34:09 +0200 (sam., 14 juin 2008) | 3 lines silence the test when it is skipped on some platforms. should fix a buildbot. ........ r64301 | georg.brandl | 2008-06-15 21:54:36 +0200 (dim., 15 juin 2008) | 2 lines Forward-port new test from r64300. ........ r64303 | raymond.hettinger | 2008-06-16 03:42:40 +0200 (lun., 16 juin 2008) | 1 line Issue 3116: fix quadratic behavior in marshal.dumps(). ........ r64320 | georg.brandl | 2008-06-16 23:00:47 +0200 (lun., 16 juin 2008) | 2 lines Add Jesse Noller to the developers list. ........ r64328 | georg.brandl | 2008-06-17 11:01:35 +0200 (mar., 17 juin 2008) | 2 lines Split the HTML index. ........ r64338 | vinay.sajip | 2008-06-17 13:02:14 +0200 (mar., 17 juin 2008) | 1 line Bug #3126: StreamHandler and FileHandler check before calling "flush" and "close" that the stream object has these, using hasattr (thanks to bobf for the patch). ........ r64339 | vinay.sajip | 2008-06-17 13:04:02 +0200 (mar., 17 juin 2008) | 1 line Updated with fix for #3126. ........
This commit is contained in:
parent
6a00b64429
commit
35c8658a74
|
@ -95,6 +95,9 @@ html_static_path = ['tools/sphinxext/static']
|
||||||
# Output file base name for HTML help builder.
|
# Output file base name for HTML help builder.
|
||||||
htmlhelp_basename = 'python' + release.replace('.', '')
|
htmlhelp_basename = 'python' + release.replace('.', '')
|
||||||
|
|
||||||
|
# Split the index
|
||||||
|
html_split_index = True
|
||||||
|
|
||||||
|
|
||||||
# Options for LaTeX output
|
# Options for LaTeX output
|
||||||
# ------------------------
|
# ------------------------
|
||||||
|
|
|
@ -636,9 +636,9 @@ Or, where the user fails to pass a value at all::
|
||||||
option involved in the error; be sure to do the same when calling
|
option involved in the error; be sure to do the same when calling
|
||||||
``parser.error()`` from your application code.
|
``parser.error()`` from your application code.
|
||||||
|
|
||||||
If :mod:`optparse`'s default error-handling behaviour does not suite your needs,
|
If :mod:`optparse`'s default error-handling behaviour does not suit your needs,
|
||||||
you'll need to subclass OptionParser and override ``exit()`` and/or
|
you'll need to subclass OptionParser and override its :meth:`exit` and/or
|
||||||
:meth:`error`.
|
:meth:`error` methods.
|
||||||
|
|
||||||
|
|
||||||
.. _optparse-putting-it-all-together:
|
.. _optparse-putting-it-all-together:
|
||||||
|
|
|
@ -521,6 +521,21 @@ environment variable.
|
||||||
|
|
||||||
.. ======================================================================
|
.. ======================================================================
|
||||||
|
|
||||||
|
.. _pep-0371:
|
||||||
|
|
||||||
|
PEP 371: The ``multiprocessing`` Package
|
||||||
|
=====================================================
|
||||||
|
|
||||||
|
XXX write this.
|
||||||
|
|
||||||
|
.. seealso::
|
||||||
|
|
||||||
|
:pep:`371` - Per-user ``site-packages`` Directory
|
||||||
|
PEP written by Jesse Noller and Richard Oudkerk;
|
||||||
|
implemented by Jesse Noller.
|
||||||
|
|
||||||
|
.. ======================================================================
|
||||||
|
|
||||||
.. _pep-3101:
|
.. _pep-3101:
|
||||||
|
|
||||||
PEP 3101: Advanced String Formatting
|
PEP 3101: Advanced String Formatting
|
||||||
|
|
|
@ -731,7 +731,7 @@ class StreamHandler(Handler):
|
||||||
"""
|
"""
|
||||||
Flushes the stream.
|
Flushes the stream.
|
||||||
"""
|
"""
|
||||||
if self.stream:
|
if self.stream and hasattr(self.stream, "flush"):
|
||||||
self.stream.flush()
|
self.stream.flush()
|
||||||
|
|
||||||
def emit(self, record):
|
def emit(self, record):
|
||||||
|
@ -787,7 +787,8 @@ class FileHandler(StreamHandler):
|
||||||
"""
|
"""
|
||||||
if self.stream:
|
if self.stream:
|
||||||
self.flush()
|
self.flush()
|
||||||
self.stream.close()
|
if hasattr(self.stream, "close"):
|
||||||
|
self.stream.close()
|
||||||
StreamHandler.close(self)
|
StreamHandler.close(self)
|
||||||
self.stream = None
|
self.stream = None
|
||||||
|
|
||||||
|
|
|
@ -1066,23 +1066,30 @@ def uname():
|
||||||
|
|
||||||
"""
|
"""
|
||||||
global _uname_cache
|
global _uname_cache
|
||||||
|
no_os_uname = 0
|
||||||
|
|
||||||
if _uname_cache is not None:
|
if _uname_cache is not None:
|
||||||
return _uname_cache
|
return _uname_cache
|
||||||
|
|
||||||
|
processor = ''
|
||||||
|
|
||||||
# Get some infos from the builtin os.uname API...
|
# Get some infos from the builtin os.uname API...
|
||||||
try:
|
try:
|
||||||
system,node,release,version,machine = os.uname()
|
system,node,release,version,machine = os.uname()
|
||||||
|
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
# Hmm, no uname... we'll have to poke around the system then.
|
no_os_uname = 1
|
||||||
system = sys.platform
|
|
||||||
release = ''
|
if no_os_uname or not filter(None, (system, node, release, version, machine)):
|
||||||
version = ''
|
# Hmm, no there is either no uname or uname has returned
|
||||||
node = _node()
|
#'unknowns'... we'll have to poke around the system then.
|
||||||
machine = ''
|
if no_os_uname:
|
||||||
processor = ''
|
system = sys.platform
|
||||||
use_syscmd_ver = 1
|
release = ''
|
||||||
|
version = ''
|
||||||
|
node = _node()
|
||||||
|
machine = ''
|
||||||
|
|
||||||
|
use_syscmd_ver = 01
|
||||||
|
|
||||||
# Try win32_ver() on win32 platforms
|
# Try win32_ver() on win32 platforms
|
||||||
if system == 'win32':
|
if system == 'win32':
|
||||||
|
@ -1093,8 +1100,10 @@ def uname():
|
||||||
# available on Win XP and later; see
|
# available on Win XP and later; see
|
||||||
# http://support.microsoft.com/kb/888731 and
|
# http://support.microsoft.com/kb/888731 and
|
||||||
# http://www.geocities.com/rick_lively/MANUALS/ENV/MSWIN/PROCESSI.HTM
|
# http://www.geocities.com/rick_lively/MANUALS/ENV/MSWIN/PROCESSI.HTM
|
||||||
machine = os.environ.get('PROCESSOR_ARCHITECTURE', '')
|
if not machine:
|
||||||
processor = os.environ.get('PROCESSOR_IDENTIFIER', machine)
|
machine = os.environ.get('PROCESSOR_ARCHITECTURE', '')
|
||||||
|
if not processor:
|
||||||
|
processor = os.environ.get('PROCESSOR_IDENTIFIER', machine)
|
||||||
|
|
||||||
# Try the 'ver' system command available on some
|
# Try the 'ver' system command available on some
|
||||||
# platforms
|
# platforms
|
||||||
|
@ -1136,30 +1145,28 @@ def uname():
|
||||||
release,(version,stage,nonrel),machine = mac_ver()
|
release,(version,stage,nonrel),machine = mac_ver()
|
||||||
system = 'MacOS'
|
system = 'MacOS'
|
||||||
|
|
||||||
else:
|
# System specific extensions
|
||||||
# System specific extensions
|
if system == 'OpenVMS':
|
||||||
if system == 'OpenVMS':
|
# OpenVMS seems to have release and version mixed up
|
||||||
# OpenVMS seems to have release and version mixed up
|
if not release or release == '0':
|
||||||
if not release or release == '0':
|
release = version
|
||||||
release = version
|
version = ''
|
||||||
version = ''
|
# Get processor information
|
||||||
# Get processor information
|
try:
|
||||||
try:
|
import vms_lib
|
||||||
import vms_lib
|
except ImportError:
|
||||||
except ImportError:
|
pass
|
||||||
pass
|
|
||||||
else:
|
|
||||||
csid, cpu_number = vms_lib.getsyi('SYI$_CPU',0)
|
|
||||||
if (cpu_number >= 128):
|
|
||||||
processor = 'Alpha'
|
|
||||||
else:
|
|
||||||
processor = 'VAX'
|
|
||||||
else:
|
else:
|
||||||
# Get processor information from the uname system command
|
csid, cpu_number = vms_lib.getsyi('SYI$_CPU',0)
|
||||||
processor = _syscmd_uname('-p','')
|
if (cpu_number >= 128):
|
||||||
|
processor = 'Alpha'
|
||||||
|
else:
|
||||||
|
processor = 'VAX'
|
||||||
|
if not processor:
|
||||||
|
# Get processor information from the uname system command
|
||||||
|
processor = _syscmd_uname('-p','')
|
||||||
|
|
||||||
# 'unknown' is not really any useful as information; we'll convert
|
#If any unknowns still exist, replace them with ''s, which are more portable
|
||||||
# it to '' which is more portable
|
|
||||||
if system == 'unknown':
|
if system == 'unknown':
|
||||||
system = ''
|
system = ''
|
||||||
if node == 'unknown':
|
if node == 'unknown':
|
||||||
|
|
|
@ -27,10 +27,9 @@ class Base(object):
|
||||||
class Base2(object):
|
class Base2(object):
|
||||||
mykey = 'from Base2'
|
mykey = 'from Base2'
|
||||||
|
|
||||||
class X(Base):
|
# you can't add a non-string key to X.__dict__, but it can be
|
||||||
# you can't add a non-string key to X.__dict__, but it can be
|
# there from the beginning :-)
|
||||||
# there from the beginning :-)
|
X = type('X', (Base,), {MyKey(): 5})
|
||||||
locals()[MyKey()] = 5
|
|
||||||
|
|
||||||
print(X.mykey)
|
print(X.mykey)
|
||||||
# I get a segfault, or a slightly wrong assertion error in a debug build.
|
# I get a segfault, or a slightly wrong assertion error in a debug build.
|
||||||
|
|
|
@ -335,6 +335,7 @@ class GrammarTests(unittest.TestCase):
|
||||||
self.assertEquals(l5(1, 2), 5)
|
self.assertEquals(l5(1, 2), 5)
|
||||||
self.assertEquals(l5(1, 2, 3), 6)
|
self.assertEquals(l5(1, 2, 3), 6)
|
||||||
check_syntax_error(self, "lambda x: x = 2")
|
check_syntax_error(self, "lambda x: x = 2")
|
||||||
|
check_syntax_error(self, "lambda (None,): None")
|
||||||
l6 = lambda x, y, *, k=20: x+y+k
|
l6 = lambda x, y, *, k=20: x+y+k
|
||||||
self.assertEquals(l6(1,2), 1+2+20)
|
self.assertEquals(l6(1,2), 1+2+20)
|
||||||
self.assertEquals(l6(1,2,k=10), 1+2+10)
|
self.assertEquals(l6(1,2,k=10), 1+2+10)
|
||||||
|
|
|
@ -211,10 +211,11 @@ class TestHeapC(TestHeap):
|
||||||
class LE:
|
class LE:
|
||||||
def __init__(self, x):
|
def __init__(self, x):
|
||||||
self.x = x
|
self.x = x
|
||||||
def __lt__(self, other):
|
def __le__(self, other):
|
||||||
return self.x >= other.x
|
return self.x >= other.x
|
||||||
data = [random.random() for i in range(100)]
|
data = [random.random() for i in range(100)]
|
||||||
target = sorted(data, reverse=True)
|
target = sorted(data, reverse=True)
|
||||||
|
print("HASATTR", hasattr(LE(0), "__lt__"), LE(0).__lt__)
|
||||||
self.assertEqual(hsort(data, LT), target)
|
self.assertEqual(hsort(data, LT), target)
|
||||||
self.assertEqual(hsort(data, LE), target)
|
self.assertEqual(hsort(data, LE), target)
|
||||||
|
|
||||||
|
|
|
@ -8,6 +8,7 @@ from test.support import TestFailed, verbose, run_unittest, catch_warning
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
ISBIGENDIAN = sys.byteorder == "big"
|
ISBIGENDIAN = sys.byteorder == "big"
|
||||||
|
IS32BIT = sys.maxsize == 0x7fffffff
|
||||||
del sys
|
del sys
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
@ -580,6 +581,11 @@ class StructTest(unittest.TestCase):
|
||||||
for c in [b'\x01', b'\x7f', b'\xff', b'\x0f', b'\xf0']:
|
for c in [b'\x01', b'\x7f', b'\xff', b'\x0f', b'\xf0']:
|
||||||
self.assertTrue(struct.unpack('>?', c)[0])
|
self.assertTrue(struct.unpack('>?', c)[0])
|
||||||
|
|
||||||
|
if IS32BIT:
|
||||||
|
def test_crasher(self):
|
||||||
|
self.assertRaises(MemoryError, struct.pack, "357913941b", "a")
|
||||||
|
|
||||||
|
|
||||||
def test_main():
|
def test_main():
|
||||||
run_unittest(StructTest)
|
run_unittest(StructTest)
|
||||||
|
|
||||||
|
|
|
@ -520,6 +520,9 @@ class SizeofTest(unittest.TestCase):
|
||||||
self.check_sizeof(32768, h + self.align(2) + 2)
|
self.check_sizeof(32768, h + self.align(2) + 2)
|
||||||
self.check_sizeof(32768*32768-1, h + self.align(2) + 2)
|
self.check_sizeof(32768*32768-1, h + self.align(2) + 2)
|
||||||
self.check_sizeof(32768*32768, h + self.align(2) + 4)
|
self.check_sizeof(32768*32768, h + self.align(2) + 4)
|
||||||
|
# tuple
|
||||||
|
self.check_sizeof((), h)
|
||||||
|
self.check_sizeof((1,2,3), h + 3*p)
|
||||||
|
|
||||||
|
|
||||||
def test_main():
|
def test_main():
|
||||||
|
|
|
@ -486,6 +486,7 @@ Samuel Nicolary
|
||||||
Gustavo Niemeyer
|
Gustavo Niemeyer
|
||||||
Oscar Nierstrasz
|
Oscar Nierstrasz
|
||||||
Hrvoje Niksic
|
Hrvoje Niksic
|
||||||
|
Jesse Noller
|
||||||
Bill Noon
|
Bill Noon
|
||||||
Stefan Norberg
|
Stefan Norberg
|
||||||
Tim Northover
|
Tim Northover
|
||||||
|
@ -502,6 +503,7 @@ Jason Orendorff
|
||||||
Douglas Orr
|
Douglas Orr
|
||||||
Denis S. Otkidach
|
Denis S. Otkidach
|
||||||
Michael Otteneder
|
Michael Otteneder
|
||||||
|
R. M. Oudkerk
|
||||||
Russel Owen
|
Russel Owen
|
||||||
Ondrej Palkovsky
|
Ondrej Palkovsky
|
||||||
Mike Pall
|
Mike Pall
|
||||||
|
@ -673,6 +675,7 @@ Steven Taschuk
|
||||||
Monty Taylor
|
Monty Taylor
|
||||||
Amy Taylor
|
Amy Taylor
|
||||||
Tobias Thelen
|
Tobias Thelen
|
||||||
|
James Thomas
|
||||||
Robin Thomas
|
Robin Thomas
|
||||||
Eric Tiedemann
|
Eric Tiedemann
|
||||||
Tracy Tims
|
Tracy Tims
|
||||||
|
|
|
@ -17,6 +17,9 @@ the format to accommodate documentation needs as they arise.
|
||||||
Permissions History
|
Permissions History
|
||||||
-------------------
|
-------------------
|
||||||
|
|
||||||
|
- Jesse Noller was given SVN access on 16 June 2008 by Georg Brandl,
|
||||||
|
for work on the multiprocessing module.
|
||||||
|
|
||||||
- Gregor Lingl was given SVN access on 10 June 2008 by MvL,
|
- Gregor Lingl was given SVN access on 10 June 2008 by MvL,
|
||||||
for work on the turtle module.
|
for work on the turtle module.
|
||||||
|
|
||||||
|
|
|
@ -1815,6 +1815,8 @@ buffer_info(PyObject *self, PyObject *arg)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
shape = PyTuple_New(dict->ndim);
|
shape = PyTuple_New(dict->ndim);
|
||||||
|
if (shape == NULL)
|
||||||
|
return NULL;
|
||||||
for (i = 0; i < (int)dict->ndim; ++i)
|
for (i = 0; i < (int)dict->ndim; ++i)
|
||||||
PyTuple_SET_ITEM(shape, i, PyLong_FromSsize_t(dict->shape[i]));
|
PyTuple_SET_ITEM(shape, i, PyLong_FromSsize_t(dict->shape[i]));
|
||||||
|
|
||||||
|
|
|
@ -1383,6 +1383,12 @@ prepare_s(PyStructObject *self)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* check for overflow */
|
||||||
|
if ((len + 1) > (PY_SSIZE_T_MAX / sizeof(formatcode))) {
|
||||||
|
PyErr_NoMemory();
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
self->s_size = size;
|
self->s_size = size;
|
||||||
self->s_len = len;
|
self->s_len = len;
|
||||||
codes = PyMem_MALLOC((len + 1) * sizeof(formatcode));
|
codes = PyMem_MALLOC((len + 1) * sizeof(formatcode));
|
||||||
|
|
|
@ -421,6 +421,9 @@ newarrayobject(PyTypeObject *type, Py_ssize_t size, struct arraydescr *descr)
|
||||||
if (op == NULL) {
|
if (op == NULL) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
op->ob_descr = descr;
|
||||||
|
op->allocated = size;
|
||||||
|
op->weakreflist = NULL;
|
||||||
Py_SIZE(op) = size;
|
Py_SIZE(op) = size;
|
||||||
if (size <= 0) {
|
if (size <= 0) {
|
||||||
op->ob_item = NULL;
|
op->ob_item = NULL;
|
||||||
|
@ -428,13 +431,10 @@ newarrayobject(PyTypeObject *type, Py_ssize_t size, struct arraydescr *descr)
|
||||||
else {
|
else {
|
||||||
op->ob_item = PyMem_NEW(char, nbytes);
|
op->ob_item = PyMem_NEW(char, nbytes);
|
||||||
if (op->ob_item == NULL) {
|
if (op->ob_item == NULL) {
|
||||||
PyObject_Del(op);
|
Py_DECREF(op);
|
||||||
return PyErr_NoMemory();
|
return PyErr_NoMemory();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
op->ob_descr = descr;
|
|
||||||
op->allocated = size;
|
|
||||||
op->weakreflist = NULL;
|
|
||||||
op->ob_exports = 0;
|
op->ob_exports = 0;
|
||||||
return (PyObject *) op;
|
return (PyObject *) op;
|
||||||
}
|
}
|
||||||
|
@ -808,11 +808,15 @@ array_do_extend(arrayobject *self, PyObject *bb)
|
||||||
"can only extend with array of same kind");
|
"can only extend with array of same kind");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
if ((Py_SIZE(self) > PY_SSIZE_T_MAX - Py_SIZE(b)) ||
|
||||||
|
((Py_SIZE(self) + Py_SIZE(b)) > PY_SSIZE_T_MAX / self->ob_descr->itemsize)) {
|
||||||
|
PyErr_NoMemory();
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
size = Py_SIZE(self) + Py_SIZE(b);
|
size = Py_SIZE(self) + Py_SIZE(b);
|
||||||
PyMem_RESIZE(self->ob_item, char, size*self->ob_descr->itemsize);
|
PyMem_RESIZE(self->ob_item, char, size*self->ob_descr->itemsize);
|
||||||
if (self->ob_item == NULL) {
|
if (self->ob_item == NULL) {
|
||||||
PyObject_Del(self);
|
PyErr_NoMemory();
|
||||||
PyErr_NoMemory();
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
memcpy(self->ob_item + Py_SIZE(self)*self->ob_descr->itemsize,
|
memcpy(self->ob_item + Py_SIZE(self)*self->ob_descr->itemsize,
|
||||||
|
|
|
@ -683,13 +683,25 @@ tuple_getnewargs(PyTupleObject *v)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static PyObject *
|
||||||
|
tuple_sizeof(PyTupleObject *self)
|
||||||
|
{
|
||||||
|
Py_ssize_t res;
|
||||||
|
|
||||||
|
res = PyTuple_Type.tp_basicsize + Py_SIZE(self) * sizeof(PyObject *);
|
||||||
|
return PyLong_FromSsize_t(res);
|
||||||
|
}
|
||||||
|
|
||||||
PyDoc_STRVAR(index_doc,
|
PyDoc_STRVAR(index_doc,
|
||||||
"T.index(value, [start, [stop]]) -> integer -- return first index of value");
|
"T.index(value, [start, [stop]]) -> integer -- return first index of value");
|
||||||
PyDoc_STRVAR(count_doc,
|
PyDoc_STRVAR(count_doc,
|
||||||
"T.count(value) -> integer -- return number of occurrences of value");
|
"T.count(value) -> integer -- return number of occurrences of value");
|
||||||
|
PyDoc_STRVAR(sizeof_doc,
|
||||||
|
"T.__sizeof__() -- size of T in memory, in bytes");
|
||||||
|
|
||||||
static PyMethodDef tuple_methods[] = {
|
static PyMethodDef tuple_methods[] = {
|
||||||
{"__getnewargs__", (PyCFunction)tuple_getnewargs, METH_NOARGS},
|
{"__getnewargs__", (PyCFunction)tuple_getnewargs, METH_NOARGS},
|
||||||
|
{"__sizeof__", (PyCFunction)tuple_sizeof, METH_NOARGS, sizeof_doc},
|
||||||
{"index", (PyCFunction)tupleindex, METH_VARARGS, index_doc},
|
{"index", (PyCFunction)tupleindex, METH_VARARGS, index_doc},
|
||||||
{"count", (PyCFunction)tuplecount, METH_O, count_doc},
|
{"count", (PyCFunction)tuplecount, METH_O, count_doc},
|
||||||
{NULL, NULL} /* sentinel */
|
{NULL, NULL} /* sentinel */
|
||||||
|
|
|
@ -70,7 +70,7 @@ w_more(int c, WFILE *p)
|
||||||
size = PyBytes_Size(p->str);
|
size = PyBytes_Size(p->str);
|
||||||
newsize = size + size + 1024;
|
newsize = size + size + 1024;
|
||||||
if (newsize > 32*1024*1024) {
|
if (newsize > 32*1024*1024) {
|
||||||
newsize = size + 1024*1024;
|
newsize = size + (size >> 3); /* 12.5% overallocation */
|
||||||
}
|
}
|
||||||
if (_PyBytes_Resize(&p->str, newsize) != 0) {
|
if (_PyBytes_Resize(&p->str, newsize) != 0) {
|
||||||
p->ptr = p->end = NULL;
|
p->ptr = p->end = NULL;
|
||||||
|
|
|
@ -284,7 +284,8 @@ def add_stream(db, name, path):
|
||||||
|
|
||||||
def init_database(name, schema,
|
def init_database(name, schema,
|
||||||
ProductName, ProductCode, ProductVersion,
|
ProductName, ProductCode, ProductVersion,
|
||||||
Manufacturer):
|
Manufacturer,
|
||||||
|
request_uac = False):
|
||||||
try:
|
try:
|
||||||
os.unlink(name)
|
os.unlink(name)
|
||||||
except OSError:
|
except OSError:
|
||||||
|
@ -306,7 +307,11 @@ def init_database(name, schema,
|
||||||
si.SetProperty(PID_AUTHOR, Manufacturer)
|
si.SetProperty(PID_AUTHOR, Manufacturer)
|
||||||
si.SetProperty(PID_TEMPLATE, msi_type)
|
si.SetProperty(PID_TEMPLATE, msi_type)
|
||||||
si.SetProperty(PID_REVNUMBER, gen_uuid())
|
si.SetProperty(PID_REVNUMBER, gen_uuid())
|
||||||
si.SetProperty(PID_WORDCOUNT, 2) # long file names, compressed, original media
|
if request_uac:
|
||||||
|
wc = 2 # long file names, compressed, original media
|
||||||
|
else:
|
||||||
|
wc = 2 | 8 # +never invoke UAC
|
||||||
|
si.SetProperty(PID_WORDCOUNT, wc)
|
||||||
si.SetProperty(PID_PAGECOUNT, 200)
|
si.SetProperty(PID_PAGECOUNT, 200)
|
||||||
si.SetProperty(PID_APPNAME, "Python MSI Library")
|
si.SetProperty(PID_APPNAME, "Python MSI Library")
|
||||||
# XXX more properties
|
# XXX more properties
|
||||||
|
|
Loading…
Reference in New Issue