Gregory P. Smith
eeed5b7c22
Merge this fix from the pybsddb tree:
...
r293 | jcea | 2008-01-31 01:08:19 -0800 (Thu, 31 Jan 2008) | 4 lines
Solved memory leak when using cursors with
databases without environment.
2008-02-03 07:20:53 +00:00
Andrew MacIntyre
94dcf0ddbf
The wrapper function is supposed to be for spawnvpe() so that's
...
what we should call [this wrapper only available on OS/2].
Backport candidate to 2.5.
2008-02-03 07:07:31 +00:00
Raymond Hettinger
fe424f754f
Neaten-up a bit.
2008-02-02 05:24:44 +00:00
Christian Heimes
d491d71903
More int -> pid_t.
2008-02-01 18:49:26 +00:00
Jeffrey Yasskin
ca2b69f765
Move __builtins__.trunc() to math.trunc() per
...
http://mail.python.org/pipermail/python-dev/2008-January/076626.html and issue
1965.
2008-02-01 06:22:46 +00:00
Christian Heimes
951cc0f474
Fixed bug #1983 : Return from fork() is pid_t, not int
2008-01-31 23:08:23 +00:00
Thomas Heller
99120c4f7e
Revert rev. 59925, it breaks comtypes (I need to further examine this).
2008-01-28 08:44:13 +00:00
Christian Heimes
d7e1b2bd17
static PyObject* variables should use PyString_InternFromString() instead of PyObject_FromString() to store a python string in a function level static var.
2008-01-28 02:07:53 +00:00
Neal Norwitz
b3c8243c47
Update to newer version of ffi. Fixes crashes and test failures of longdouble
2008-01-27 17:10:43 +00:00
Neal Norwitz
e9057ff1a9
Initialize variable to prevent warning on some platform/config.
2008-01-27 17:10:35 +00:00
Neal Norwitz
e1027f9034
Use int for the sign rather than a char. char can be signed or unsigned.
...
It's system dependent. This might fix the problem with test_rfind failing.
2008-01-27 07:37:38 +00:00
Neal Norwitz
448654f1f8
Mostly reformat. Also set an error and return NULL if neither MS_WINDOWS
...
nor UNIX is defined. This may have caused problems on cygwin.
2008-01-27 07:36:03 +00:00
Neal Norwitz
739a3c40e6
Cleanup the code a bit. test_rfind is failing on PPC and PPC64 buildbots,
...
this might fix the problem.
2008-01-26 20:24:36 +00:00
Georg Brandl
29604a1b4c
#1940 : make it possible to use curses.filter() before curses.initscr()
...
as the documentation says.
2008-01-26 14:03:47 +00:00
Christian Heimes
543cabc842
setup.py doesn't pick up changes to a header file
2008-01-25 14:54:23 +00:00
Christian Heimes
7f39c9fcbb
Backport of several functions from Python 3.0 to 2.6 including PyUnicode_FromString, PyUnicode_Format and PyLong_From/AsSsize_t. The functions are partly required for the backport of the bytearray type and _fileio module. They should also make it easier to port C to 3.0.
...
First chapter of the Python 3.0 io framework back port: _fileio
The next step depends on a working bytearray type which itself depends on a backport of the nwe buffer API.
2008-01-25 12:18:43 +00:00
Neal Norwitz
5f95a79b2b
Add prototypes to get the mathmodule.c to compile on OSF1 5.1 (Tru64)
...
and eliminate a compiler warning in floatobject.c. There might be
a better way to go about this, but it should be good enough for now.
2008-01-25 08:04:16 +00:00
Thomas Heller
5ca924038d
Invert the checks in get_[u]long and get_[u]longlong. The intent was
...
to not accept float types; the result was that integer-like objects
were not accepted.
Ported from release25-maint.
2008-01-24 19:15:02 +00:00
Thomas Heller
71dba4ccee
Replace Py_BuildValue with PyTuple_Pack because it is faster.
...
Also add a missing DECREF.
2008-01-24 18:54:12 +00:00
Thomas Heller
e4c03e4520
Use a PyDictObject again for the array type cache; retrieving items
...
from the WeakValueDictionary was slower by nearly a factor of 3.
To avoid leaks, weakref proxies for the array types are put into the
cache dict, with weakref callbacks that removes the entries when the
type goes away.
2008-01-24 18:36:27 +00:00
Guido van Rossum
6f4ee2d48f
Fix misleading comment reported in issue #1917 .
2008-01-23 22:43:27 +00:00
Armin Rigo
964ca4274f
patch 1754489 by vlahan:
...
improve portability of address length calculation for AF_UNIX sockets
2008-01-23 14:07:13 +00:00
Christian Heimes
501dbbfb70
Use Py_TYPE() instead of ->ob_type
2008-01-23 14:00:25 +00:00
Georg Brandl
d02fc48f67
Fix for #1087741 patch.
2008-01-22 19:56:03 +00:00
Georg Brandl
c09b94e063
Reformat some ugly code.
2008-01-21 21:28:32 +00:00
Georg Brandl
32a3fb5ec9
Patch #1720595 : add T_BOOL to the range of structmember types.
...
Patch by Angelo Mottola, reviewed by MvL, tests by me.
2008-01-21 21:23:15 +00:00
Georg Brandl
845c403c08
#1087741 : make mmap.mmap the type of mmap objects, not a
...
factory function. Allow it to be subclassed.
2008-01-21 14:16:46 +00:00
Georg Brandl
ef92802f73
Switch mmap from old Py_FindMethod to new PyObject_GenericGetAttr attribute access.
...
Fixes #1087735 .
2008-01-20 14:50:05 +00:00
Georg Brandl
f558d2e5f5
#1509 : fix sqlite3 docstrings and docs w.r.t. cursor.fetchXXX methods.
2008-01-19 20:53:07 +00:00
Andrew M. Kuchling
060e6855a8
Patch #1019808 from Federico Schwindt: Return correct socket error when
...
a default timeout has been set, by using getsockopt() to get the error
condition (instead of trying another connect() call, which seems to be
a Linuxism).
2.5 bugfix candidate, assuming no one reports any problems with this change.
2008-01-19 20:47:59 +00:00
Georg Brandl
309501a617
#1663329 : add os.closerange() to close a range of fds,
...
ignoring errors, and use this in subprocess to speed up
subprocess creation in close_fds mode. Patch by Mike Klaas.
2008-01-19 20:22:13 +00:00
Andrew M. Kuchling
5c60bfcfbf
Patch #976880 : add mmap .rfind() method, and 'end' paramter to .find().
...
Contributed by John Lenton.
2008-01-19 18:18:41 +00:00
Christian Heimes
4956d2b889
Silence Coverity false alerts with CIDs #172 , #183 , #184
2008-01-18 19:12:56 +00:00
Christian Heimes
5cc3f26c48
Coverity CID #168
...
leaked_storage: Returned without freeing storage "fp"
2008-01-18 08:53:45 +00:00
Christian Heimes
87dcf3d260
Coverity issue CID #182
...
size_error: Allocating 1 bytes to pointer "children", which needs at least 4 bytes
2008-01-18 08:04:57 +00:00
Christian Heimes
62a8e95fea
Coverity issue CID #197
...
var_decl: Declared variable "stm" without initializer
ninit_use_in_call: Using uninitialized value "stm" (field "stm".tm_zone uninitialized) in call to function "mktime"
2008-01-18 07:30:20 +00:00
Raymond Hettinger
18e08e5e61
clearcache() needs to remove the dict as well as clear it.
2008-01-18 00:10:42 +00:00
Brett Cannon
a35a8b11c3
Fix a function pointer declaration to silence the compiler.
2008-01-17 18:45:10 +00:00
Raymond Hettinger
473170908e
Make starmap() match its pure python definition and accept any itertable input (not just tuples).
2008-01-17 03:02:14 +00:00
Thomas Heller
0f75f9847a
Use 'g' instead of 'D' as the ctypes typecode for c_longdouble, for
...
compliance with PEP 3118.
2008-01-16 20:34:37 +00:00
Thomas Heller
415c1e36a9
Raise a TypeError instead of a ValueError when too many initializers
...
are used in a Structure or Union constructor.
2008-01-16 19:45:51 +00:00
Thomas Heller
02ec289f3e
Raise a TypeError if conflicting positional and named arguments are
...
passed to a Structure or Union constructor.
2008-01-16 19:37:33 +00:00
Thomas Heller
902d30752f
Convert the internal ctypes array type cache to a WeakValueDict so
...
that array types do not live longer than needed.
2008-01-16 19:16:27 +00:00
Thomas Heller
7a66a1becc
Issue 1821: configure libffi for amd64 on FreeeBSD.
2008-01-14 10:35:28 +00:00
Amaury Forgeot d'Arc
7cdf5f5c31
?Why did my tests not notice this before?
...
Slots inheritance is very different from OO inheritance.
This code lead to infinite recursion on classes derived from StructType.
2008-01-14 01:07:27 +00:00
Amaury Forgeot d'Arc
08ccf202e6
As discussed in issue 1700288:
...
ctypes takes some liberties when creating python types: it modifies the types'
__dict__ directly, bypassing all the machinery of type objects which deal with
special methods. And this broke recent optimisations of method lookup.
Now we try to modify the type with more "official" functions.
2008-01-14 00:22:44 +00:00
Thomas Heller
5f0b7ae481
Make Modules/socketobject.c compile for Windows again.
2008-01-13 11:19:43 +00:00
Thomas Heller
43617bc610
Fix a potential 'SystemError: NULL result without error'.
...
NULL may be a valid return value from PyLong_AsVoidPtr.
Will backport to release25-maint.
2008-01-11 20:29:19 +00:00
Thomas Heller
c682614df0
Raise an error instead of crashing with a segfault when a NULL
...
function pointer is called.
Will backport to release25-maint.
2008-01-11 19:34:06 +00:00
Christian Heimes
0f973934f4
Removed unused variable
2008-01-11 15:42:29 +00:00
Georg Brandl
ff15c866a6
Guard definition of TIPC_SUB_CANCEL with an #ifdef.
2008-01-11 09:19:11 +00:00
Raymond Hettinger
a7d984e838
Comment-out missing constant (from rev 59819)
2008-01-11 02:12:33 +00:00
Andrew M. Kuchling
7c22ccc3dd
Check for fd of -1 to save fsync() and fstat() call
2008-01-10 13:37:12 +00:00
Andrew M. Kuchling
3eb4aa733a
Related to patch #1114 : fix another place where attr_t is assumed to be a long
2008-01-09 12:27:41 +00:00
Facundo Batista
4473d225a8
Issue 846388. Adds a call to PyErr_CheckSignals to
...
SRE_MATCH so that signal handlers can be invoked during
long regular expression matches. It also adds a new
error return value indicating that an exception
occurred in a signal handler during the match, allowing
exceptions in the signal handler to propagate up to the
main loop. Thanks Josh Hoyt and Ralf Schmitt.
2008-01-08 21:10:12 +00:00
Thomas Heller
41f278ffa5
Use relative instead of absolute filenames in the C-level tracebacks.
...
This prevents traceback prints pointing to files in this way:
File "\loewis\25\python\Modules\_ctypes\callbacks.c", line 206, in 'calling callback function'
2008-01-08 15:15:09 +00:00
Andrew M. Kuchling
62182c8b72
Patch 1114: fix compilation of curses module on 64-bit AIX, and any other LP64 platforms where attr_t isn't a C long
2008-01-08 14:56:02 +00:00
Andrew M. Kuchling
e0a49b6e05
Patch 1137: allow assigning to .buffer_size attribute of PyExpat.parser objects
2008-01-08 14:30:55 +00:00
Georg Brandl
aed6c66aa8
patch #1668 : clarify envvar docs; rename THREADDEBUG to PYTHONTHREADDEBUG.
2008-01-07 17:25:53 +00:00
Georg Brandl
2da0fceba7
Patch #602345 by Neal Norwitz and me: add -B option and PYTHONDONTWRITEBYTECODE envvar to skip writing bytecode.
2008-01-07 17:09:35 +00:00
Christian Heimes
fb2d25a154
Issue #1646 : Make socket support TIPC. The socket module now has support
...
for TIPC under Linux, see http://tipc.sf.net/ for more information.
Thanks to Alberto Bertogli for the patch
2008-01-07 16:12:44 +00:00
Georg Brandl
f725b9587c
Doc patch #1730 from Robin Stocker; minor corrections mostly to os.rst.
2008-01-05 19:44:22 +00:00
Jeffrey Yasskin
9871d8fe22
Continue rolling back pep-3141 changes that changed behavior from 2.5. This
...
round included:
* Revert round to its 2.6 behavior (half away from 0).
* Because round, floor, and ceil always return float again, it's no
longer necessary to have them delegate to __xxx___, so I've ripped
that out of their implementations and the Real ABC. This also helps
in implementing types that work in both 2.6 and 3.0: you return int
from the __xxx__ methods, and let it get enabled by the version
upgrade.
* Make pow(-1, .5) raise a ValueError again.
2008-01-05 08:47:13 +00:00
Christian Heimes
04ae916fa2
Added interface to Windows' WSAIoctl and a simple example for a network sniffer.
2008-01-04 15:23:30 +00:00
Christian Heimes
76d19f68e4
Added _struct._clearcache() for regression tests
2008-01-04 02:54:42 +00:00
Christian Heimes
66ecda4990
Fixed math.copysign() on Windows
2008-01-04 01:48:50 +00:00
Raymond Hettinger
2f6621cce7
Finish-up the struct module optimizations started at the Iceland NFS sprint.
2008-01-04 00:01:15 +00:00
Guido van Rossum
076d9eef7b
Bug #1301 : fixed a bad assert in _tkinter.
2008-01-03 23:54:04 +00:00
Christian Heimes
eebb79cc69
Added copysign(x, y) function to the math module
2008-01-03 22:32:26 +00:00
Christian Heimes
000a074c95
Modified PyImport_Import and PyImport_ImportModule to always use absolute imports by calling __import__ with an explicit level of 0
...
Added a new API function PyImport_ImportModuleNoBlock. It solves the problem with dead locks when mixing threads and imports
2008-01-03 22:16:32 +00:00
Christian Heimes
e2ca4245c9
Added math.isinf() and math.isnan()
2008-01-03 20:23:15 +00:00
Jeffrey Yasskin
2f3c16be73
Backport PEP 3141 from the py3k branch to the trunk. This includes r50877 (just
...
the complex_pow part), r56649, r56652, r56715, r57296, r57302, r57359, r57361,
r57372, r57738, r57739, r58017, r58039, r58040, and r59390, and new
documentation. The only significant difference is that round(x) returns a float
to preserve backward-compatibility. See http://bugs.python.org/issue1689 .
2008-01-03 02:21:52 +00:00
Martin v. Löwis
17cb5cf403
Return results from Python callbacks to Tcl as Tcl objects.
...
Fixes Tk issue #1851526
2008-01-01 21:05:17 +00:00
Brett Cannon
8d993aae8f
Fix the docstrings of time.localtime() and gmtime() for the tm_mday field.
...
Will backport.
2007-12-24 19:58:25 +00:00
Guido van Rossum
02de8979cc
Patch #1583 by Adam Olsen.
...
This adds signal.set_wakeup_fd(fd) which sets a file descriptor to
which a zero byte will be written whenever a C exception handler runs.
I added a simple C API as well, PySignal_SetWakeupFd(fd).
2007-12-19 19:41:06 +00:00
Christian Heimes
e93237dfcc
#1629 : Renamed Py_Size, Py_Type and Py_Refcnt to Py_SIZE, Py_TYPE and Py_REFCNT. Macros for b/w compatibility are available.
2007-12-19 02:37:44 +00:00
Guido van Rossum
3c887b2802
Issue #1645 by Alberto Bertogli. Fix a comment.
2007-12-18 20:10:42 +00:00
Thomas Heller
153038efa4
Issue #1642 : Fix segfault in ctypes when trying to delete attributes.
2007-12-18 19:00:34 +00:00
Christian Heimes
a63f268351
Fixed warning in ssl module
2007-12-14 04:38:13 +00:00
Christian Heimes
2518b25578
Fixed a warning in _codecs_iso2022.c and some non C89 conform // comments.
2007-12-14 03:02:34 +00:00
Raymond Hettinger
adf9ffdfbe
Fix bug 1604. deque.__init__() did not clear existing contents like list.__init__. Not a backport candidate.
2007-12-13 00:08:37 +00:00
Christian Heimes
842c178442
Fixed a nasty problem in the xxmodule.c
2007-12-12 18:09:06 +00:00
Gerhard Häring
99b9df8e11
Forward-port of commit 59184.
...
- Backported a workaround for a bug in SQLite 3.2.x/3.3.x versions where a
statement recompilation with no bound parameters lead to a segfault
- Backported a fix necessary because of an SQLite API change in version
3.5.
This prevents segfaults when executing empty queries, like our test suite
does
2007-12-11 21:07:40 +00:00
Guido van Rossum
137c49ce6a
Patch #1643738 by Ulisses Furquim -- make the is_tripped variable
...
in signalmodule.c more robust. Includes Martin von Loewis's suggestion
to set is_tripped after .tripped.
2007-12-10 23:00:12 +00:00
Martin v. Löwis
7b3cc06a9a
Forward-port r59310:
...
os.access now returns True on Windows for any existing directory.
2007-12-03 23:09:04 +00:00
Martin v. Löwis
6b449f4f2b
Issue #1727780 : Support loading pickles of random.Random objects created
...
on 32-bit systems on 64-bit systems, and vice versa. As a consequence
of the change, Random pickles created by Python 2.6 cannot be loaded
in Python 2.5.
2007-12-03 19:20:02 +00:00
Christian Heimes
0f6d4e6cd3
I followed MA Lemberg's suggestion and added comments to the late initialization of the type slots.
2007-12-03 14:28:04 +00:00
Christian Heimes
3305c52de7
Applied my patch #1455 with some extra fixes for VS 2005
...
The new msvc9compiler module supports VS 2005 and VS 2008. I've also fixed build_ext to support PCbuild8 and PCbuild9 and backported my fix for xxmodule.c from py3k. The old code msvccompiler is still in place in case somebody likes to build an extension with VS 2003 or earlier.
I've also updated the cygwin compiler module for VS 2005 and VS 2008. It works with VS 2005 but I'm unable to test it with VS 2008. We have to wait for a new version of cygwin.
2007-12-03 13:47:29 +00:00
Christian Heimes
3628187b66
Fix for feature request #1528 Add os.fchmod
...
Georg Brandl has added fchmod() and fchown(). I've contributed lchown but I'm not able to test it on Linux. However it should be available on Mac and some other flavors of Unix.
I've made a quick test of fchmod() and fchown() on my system. They are working as expected.
2007-11-30 21:11:28 +00:00
Thomas Heller
8fc2a34014
Remove unused global variable, and remove unneeded COMError.__str__
...
implementation in C.
2007-11-27 12:22:11 +00:00
Georg Brandl
b67da6ed2b
#1735632 : add O_NOATIME constant to os module.
...
Also document a few other O_ constants that were missing from documentation.
2007-11-24 13:56:09 +00:00
Christian Heimes
e8954f8ce7
Backport of the PCbuild9 directory from the py3k branch.
...
I've finished the last task for the PCbuild9 directory today. I don't think there is much left to do. Now you can all play around with the shiny new VS 2008 and try the PGO builds. I was able to get a speed improvement of about 10% on py3k.
Have fun! :)
2007-11-22 11:21:16 +00:00
Christian Heimes
901071bde5
Fixed #1372 : zlibmodule.c: int overflow in PyZlib_decompress
2007-11-21 00:46:21 +00:00
Amaury Forgeot d'Arc
5087980c1e
The incremental decoder for utf-7 must preserve its state between calls.
...
Solves issue1460.
Might not be a backport candidate: a new API function was added,
and some code may rely on details in utf-7.py.
2007-11-20 23:31:27 +00:00
Nick Coghlan
8c4592a77a
Backport some main.c cleanup from the py3k branch
2007-11-20 14:55:57 +00:00
Nick Coghlan
327a39b047
Patch #1739468 : Directories and zipfiles containing __main__.py are now executable
2007-11-18 11:56:28 +00:00
Guido van Rossum
5397fd1a51
A patch from issue 1378 by roudkerk:
...
Currently on Windows set_error() make use of a large array which maps
socket error numbers to error messages.
This patch removes that array and just lets PyErr_SetExcFromWindowsErr()
generate the message by using the Win32 function FormatMessage().
2007-11-16 00:24:44 +00:00
Christian Heimes
1bc4af4bdd
readline module cleanup
...
fixed indention to tabs
use Py_RETURN_NONE macro
added more error checks to on_completion_display_matches_hook
open question: Does PyList_SetItem(l, i, o) steal a reference to o in the case of an error?
2007-11-12 18:58:08 +00:00
Martin v. Löwis
f354894e7b
Only set rl_completion_display_matches_hook if there
...
is a Python hook function. Fixes #1425 .
2007-11-12 04:53:02 +00:00
Raymond Hettinger
d3ffd341b8
Use a freelist to speed-up block allocation and deallocation in collections.deque().
2007-11-10 01:54:03 +00:00