Commit Graph

5299 Commits

Author SHA1 Message Date
Antoine Pitrou 4c5ecb7cbb Issue #4074: Change the criteria for doing a full garbage collection (i.e.
collecting the oldest generation) so that allocating lots of objects without
destroying them does not show quadratic performance. Based on a proposal by
Martin von Löwis at http://mail.python.org/pipermail/python-dev/2008-June/080579.html.
2009-01-09 21:40:55 +00:00
Kristján Valur Jónsson 0e2d8c36e3 Issue 4293: Make Py_AddPendingCall() thread safe
Add test cases and documentation
2009-01-09 21:35:16 +00:00
Jeffrey Yasskin d89f5b20b2 Fix issue 4884, preventing a crash in the socket code when python is compiled
with llvm-gcc and run with a glibc <2.10.
2009-01-09 16:47:07 +00:00
Benjamin Peterson f902a949c6 be more specific in -3 option help 2009-01-09 03:07:27 +00:00
Raymond Hettinger 5b913e31a1 Forward port r68394 for issue 4816. 2009-01-08 06:39:04 +00:00
Guilherme Polo e7f140355b The _tkinter module functions "createfilehandler", "deletefilehandler",
"createtimerhandler", "mainloop", "dooneevent" and "quit" have been
deprecated for removal in 3.x (part of issue #3638).
2009-01-03 21:51:09 +00:00
Martin v. Löwis 9ac4927125 Issue #4051: Prevent conflict of UNICODE macros in cPickle. 2009-01-02 20:40:14 +00:00
Amaury Forgeot d'Arc 57eb0e90c1 #4801 _collections module fails to build on cygwin.
_PyObject_GC_TRACK is the macro version of PyObject_GC_Track,
and according to documentation it should not be used for extension modules.
2009-01-02 00:03:54 +00:00
Hirokazu Yamamoto 99a1b20bbf Issue #4797: IOError.filename was not set when _fileio.FileIO failed to open
file with `str' filename on Windows.
2009-01-01 15:45:39 +00:00
Antoine Pitrou aa687902f2 Issue #3680: Reference cycles created through a dict, set or deque iterator did not get collected. 2009-01-01 14:11:22 +00:00
Georg Brandl 6269fec171 #4228: Pack negative values the same way as 2.4
in struct's L format.
2009-01-01 12:15:31 +00:00
Hirokazu Yamamoto 3cda1db67f Just inserted blank line. 2008-12-31 05:47:19 +00:00
Hirokazu Yamamoto 52c1e3cc08 Fixed compile error on windows. 2008-12-31 05:24:37 +00:00
Nick Coghlan 180e400766 Issue #4701: implicitly call PyType_Ready from PyObject_Hash 2008-12-30 01:18:48 +00:00
Martin v. Löwis 03824e45f6 Issue #1040026: Fix os.times result on systems where HZ is incorrect. 2008-12-29 18:17:34 +00:00
Benjamin Peterson 7af65568ff #4764 in io.open, set IOError.filename when trying to open a directory on POSIX platforms 2008-12-29 17:56:58 +00:00
Alexandre Vassalotti f852bf97ef Fix issue #4730: cPickle corrupts high-unicode strings.
Update outdated copy of PyUnicode_EncodeRawUnicodeEscape.
Add a test case.
2008-12-27 07:08:47 +00:00
Benjamin Peterson e098c4abe5 make global static 2008-12-23 20:12:33 +00:00
Benjamin Peterson b6a53b5c52 use a global variable, so the compiler doesn't optimize the assignment out 2008-12-23 20:09:28 +00:00
Benjamin Peterson 5423abd182 silence compiler warning 2008-12-22 22:12:19 +00:00
Benjamin Peterson 4caef5c7e2 fix #4720: the format to PyArg_ParseTupleAndKeywords can now start with '|' 2008-12-22 20:51:15 +00:00
Benjamin Peterson 9de7298102 remove redundant sentence 2008-12-20 22:49:24 +00:00
Benjamin Peterson fed67fd41e beef up docstring 2008-12-20 02:57:19 +00:00
Antoine Pitrou 73c0e65fc3 Issue #2467: gc.DEBUG_STATS reports invalid elapsed times.
Patch by Neil Schemenauer, very slightly modified.
2008-12-17 22:46:54 +00:00
Amaury Forgeot d'Arc 31949b9108 #3954: Fix error handling code in _hotshot.logreader
Will port to 2.6. hotshot was deleted from python 3.
2008-12-15 21:47:57 +00:00
Nick Coghlan a2053475bb Fix several issues relating to access to source code inside zipfiles. Initial work by Alexander Belopolsky. See Misc/NEWS in this checkin for details. 2008-12-14 10:54:50 +00:00
Mark Dickinson 4c96fa5525 Issues #3167, #3682: tests for math.log and math.log10 were failing on
Solaris and OpenBSD.  Fix this by handling special values and domain
errors directly in mathmodule.c, passing only positive nonspecial floats
to the system log/log10.
2008-12-11 19:28:08 +00:00
Skip Montanaro 45313fe6e0 issue 4483 - dbm build failures on systems with gdbm_compat lib. 2008-12-06 17:43:30 +00:00
Georg Brandl fe879e8a23 #4529: fix parser's validation for try-except-finally statements. 2008-12-05 12:09:41 +00:00
Christian Heimes dee3c9c606 Issue #4025 again
Converted a C99 style comment to a C89 style comment (found by MAL).
2008-12-03 00:53:18 +00:00
Jeremy Hylton 0d52182f67 Move definition int sval into branch of ifdef where it is used.
Otherwise, you get a warning about an undefined variable.
2008-11-28 23:42:59 +00:00
Matthias Klose 4de979153e - Modules/Setup.dist: Update _elementtree, add _bisect, datetime 2008-11-27 10:14:22 +00:00
Matthias Klose b0c3c026a0 - Modules/Setup.dist: Update pyexpat 2008-11-27 07:45:25 +00:00
Matthias Klose 7fab0dcdd4 - Modules/Setup.dist: Mention _elementtree and _pickle. 2008-11-26 17:32:49 +00:00
Benjamin Peterson 9dfe6a8862 #4396 make the parser module correctly validate the with syntax 2008-11-24 04:09:03 +00:00
Matthias Klose 75bfcbaf88 - Fix typo in last checkin 2008-11-23 13:54:42 +00:00
Matthias Klose 225d60c31e - Modules/Setup.dist: Mention _functools in section "Modules that should
always be present (non UNIX dependent)"
2008-11-23 13:37:03 +00:00
Benjamin Peterson bfc51567f5 backport r67325: make FileIO.mode always contain 'b' 2008-11-22 01:59:15 +00:00
Amaury Forgeot d'Arc 322656596a Fixed issue #4233.
Changed semantic of _fileio.FileIO's close()  method on file objects with closefd=False.
The file descriptor is still kept open but the file object behaves like a closed file.
The FileIO  object also got a new readonly attribute closefd.

Approved by Barry

Backport of r67106 from the py3k branch
2008-11-20 23:34:31 +00:00
Amaury Forgeot d'Arc 7cfe7ea745 #4317: Fix an Array Bounds Read in imageop.rgb2rgb8.
Will backport to 2.4.
2008-11-18 22:19:37 +00:00
Hirokazu Yamamoto ed29bb49f8 Issue #4071: ntpath.abspath returned an empty string for long unicode path. 2008-11-08 03:46:17 +00:00
Martin v. Löwis bb86d83134 Issue #4204: Fixed module build errors on FreeBSD 4. 2008-11-04 20:40:09 +00:00
Benjamin Peterson 6624a9fddd #4048 make the parser module accept relative imports as valid 2008-11-03 15:14:51 +00:00
Benjamin Peterson dcee09d920 make sure the parser flags and passed onto the compiler
This fixes "from __future__ import unicode_literals" in an exec statment
See #4225
2008-10-31 02:16:05 +00:00
Christian Heimes ab5f879022 Issue #4237: io.FileIO() was raising invalid warnings caused by insufficient initialization of PyFileIOObject struct members. 2008-10-30 21:26:15 +00:00
Amaury Forgeot d'Arc 69a9c5b539 Issue #4176: Pickle would crash the interpreter when a __reduce__ function
does not return an iterator for the 4th and 5th items.
(sequence-like and mapping-like state)

A list is not an iterator...

Will backport to 2.6 and 2.5.
2008-10-30 21:18:34 +00:00
Amaury Forgeot d'Arc 9f616f48ca Correct error message in io.open():
closefd=True is the only accepted value with a file name.
2008-10-29 23:15:57 +00:00
Benjamin Peterson 336680ecea fix more possible ref leaks in _json and use Py_CLEAR 2008-10-16 21:48:06 +00:00
Benjamin Peterson 87e6ad290b fix possible ref leak 2008-10-16 21:27:54 +00:00
Benjamin Peterson 595e3cbb3d check for error conditions in _json #3623 2008-10-16 21:09:28 +00:00
Hirokazu Yamamoto 61376409a9 removed unused _PyUnicode_FromFileSystemEncodedObject.
made win32_chdir, win32_wchdir static.
2008-10-16 06:25:25 +00:00
Amaury Forgeot d'Arc 07d539d08b #4122: On Windows, Py_UNICODE_ISSPACE cannot be used in an extension module:
compilation fails with "undefined reference to _Py_ascii_whitespace"

Will backport to 2.6.
2008-10-14 21:47:22 +00:00
Hirokazu Yamamoto 6c75a30712 r66862 contained memory leak. 2008-10-09 10:11:21 +00:00
Hirokazu Yamamoto 10a018c285 On windows, os.chdir given unicode was not working if GetCurrentDirectoryW
returned a path longer than MAX_PATH. (But It's doubtful this code path is
really executed because I cannot move to such directory on win2k)
2008-10-09 10:00:30 +00:00
Georg Brandl f3776a17ef #3935: properly support list subclasses in the C impl. of bisect.
Patch reviewed by Raymond.
2008-10-08 18:47:17 +00:00
Andrew M. Kuchling 658c45fd3b Docstring typo. 2008-10-03 12:26:42 +00:00
Christian Heimes 32a66a0410 Fixed a couple more C99 comments and one occurence of inline. 2008-10-02 19:47:50 +00:00
Brett Cannon f40200b214 Fix a refleak introduced by r66677.
Fix suggested by Amaury Forgeot d'Arc.
Closes issue #4003.
2008-09-30 17:46:03 +00:00
Benjamin Peterson 0225248033 Victor Stinner's patches to check the return result of PyLong_Ssize_t
reviewed by Amaury
2008-09-30 02:11:07 +00:00
Benjamin Peterson 8d77d448a5 fix security issue 2: imageop's poor validation of arguments could result in segfaults
patch by Victor Stinner
reviewed by myself and Brett
2008-09-30 01:31:49 +00:00
Thomas Heller e144873071 Fix issue #3547 for MingW, update comments. 2008-09-29 19:56:24 +00:00
Brett Cannon b2d61bde28 The _lsprof module could crash the interpreter if it was given an external
timer that did not return a float and a timer was still running when the
Profiler object was garbage collected.

Fixes issue 3895.
Code review by Benjamin Peterson.
2008-09-29 03:41:21 +00:00
Jesus Cea 09c0178242 bsddb4.7.3pre9 renamed to 4.7.3 2008-09-28 23:24:19 +00:00
Thomas Heller a85c95d5e8 Fix issue #3547: ctypes is confused by bitfields of varying integer types
Reviewed by Fredrik Lundh and Skip Montanaro.
2008-09-24 18:26:05 +00:00
Jesus Cea 5cd5f12a48 Bugfix for issue3885 and 'DB.verify()' crash.
Reviewed by Nick Coghlan.
2008-09-23 18:54:08 +00:00
Hirokazu Yamamoto 09979a137a Issue #3945: Fixed compile error on cygwin. (initializer element is not constant)
Reviewed by Amaury Forgeot d'Arc.
2008-09-23 16:11:09 +00:00
Georg Brandl a438c85a88 #3897: _collections now has an underscore. 2008-09-21 07:31:52 +00:00
Georg Brandl 2f3bd8364a #3852: fix some select.kqueue and kevent docs. 2008-09-21 07:14:44 +00:00
Benjamin Peterson fbb388b39b tabify 2008-09-18 23:20:28 +00:00
Benjamin Peterson 8c2b7dc463 fix possible integer overflows in _hashopenssl #3886 2008-09-18 01:22:16 +00:00
Gerhard Häring e6872eb417 Issue #3846: Release GIL during calls to sqlite3_prepare. This improves concurrent access to the same database file from multiple threads/processes. 2008-09-12 22:33:22 +00:00
Gerhard Häring 6e1afcf988 Fixes issue #3103. In the sqlite3 module, made one more function static. All renaming public symbos now have the pysqlite prefix to avoid name clashes. This at least once created problems where the same symbol name appeared somewhere in Apache and the sqlite3 module was used from mod_python. 2008-09-12 18:58:57 +00:00
Gerhard Häring ef2276b60d sqlite3 module: Mark iterdump() method as "Non-standard" like all the other methods not found in DB-API. 2008-09-12 13:54:06 +00:00
Amaury Forgeot d'Arc 24cb382455 #3640: Correct a crash in cPickle on 64bit platforms, in the case of deeply nested lists or dicts.
Reviewed by Martin von Loewis.
2008-09-11 20:56:13 +00:00
Amaury Forgeot d'Arc 05e344954d #3743: PY_FORMAT_SIZE_T is designed for the OS "printf" functions, not for
PyString_FromFormat which has an independent implementation, and uses "%zd".

This makes a difference on win64, where printf needs "%Id" to display
64bit values. For example, queue.__repr__ was incorrect.

Reviewed by Martin von Loewis.
2008-09-10 22:04:45 +00:00
Guido van Rossum e3c4fd9cc0 - Issue #3629: Fix sre "bytecode" validator for an end case.
Reviewed by Amaury.
2008-09-10 14:27:00 +00:00
Martin v. Löwis 24329ba176 Issue #3811: The Unicode database was updated to 5.1.
Reviewed by Fredrik Lundh and Marc-Andre Lemburg.
2008-09-10 13:38:12 +00:00
Jesus Cea 69acb43327 Python3.0 bsddb testsuite compatibility improvements 2008-09-03 22:07:11 +00:00
Jesse Noller b814d6a704 Fix issue 3110 - solaris compilation of multiprocessing fails, reviewed by pitrou 2008-09-03 18:10:30 +00:00
Jesus Cea ac25fab12f Fix some leaks - Neal Norwitz 2008-09-03 17:50:32 +00:00
Jesus Cea 3b6be74304 Improve compatibility with Python3.0 testsuite 2008-09-02 02:29:06 +00:00
Benjamin Peterson f22c26ecf4 #3703 unhelpful _fileio.FileIO error message when trying to open a directory
Reviewer: Gregory P. Smith
2008-09-01 14:13:43 +00:00
Jesus Cea 4907d27c1f Update bsddb code to version 4.7.3pre2. This code should
be compatible with Python 3.0, also.

  http://www.jcea.es/programacion/pybsddb.htm#bsddb3-4.7.3
2008-08-31 14:00:51 +00:00
Neal Norwitz 901e4715bd #3662: Fix segfault introduced when fixing memory leaks.
TESTED=./python -E -tt ./Lib/test/regrtest.py test_fileio
R (approach from bug)=Amaury and Benjamin
2008-08-24 22:03:05 +00:00
Neal Norwitz 18aa388ca0 Fix:
* crashes on memory allocation failure found with failmalloc
 * memory leaks found with valgrind
 * compiler warnings in opt mode which would lead to invalid memory reads
 * problem using wrong name in decimal module reported by pychecker

Update the valgrind suppressions file with new leaks that are small/one-time
leaks we don't care about (ie, they are too hard to fix).

TBR=barry
TESTED=./python -E -tt ./Lib/test/regrtest.py -uall (both debug and opt modes)
  in opt mode:
  valgrind -q --leak-check=yes --suppressions=Misc/valgrind-python.supp \
    ./python -E -tt ./Lib/test/regrtest.py -uall,-bsddb,-compiler \
                        -x test_logging test_ssl test_multiprocessing
  valgrind -q --leak-check=yes --suppressions=Misc/valgrind-python.supp \
    ./python -E -tt ./Lib/test/regrtest.py test_multiprocessing
  for i in `seq 1 4000` ; do
    LD_PRELOAD=~/local/lib/libfailmalloc.so FAILMALLOC_INTERVAL=$i \
        ./python -c pass
  done

At least some of these fixes should probably be backported to 2.5.
2008-08-24 05:04:52 +00:00
Benjamin Peterson 37346b2b9b #3643 add a few more checks to _testcapi to prevent segfaults
Author: Victor Stinner
Reviewer: Benjamin Peterson
2008-08-23 20:27:43 +00:00
Christian Heimes 94a730540a d is the correct format string 2008-08-22 21:23:47 +00:00
Christian Heimes 1cc69636ef Fixed two format strings in the _collections module. For example
Modules/_collectionsmodule.c:674: warning: format '%i' expects type 'int', but argument 2 has type 'Py_ssize_t'
Reviewed by Benjamin Peterson
2008-08-22 20:10:27 +00:00
Christian Heimes a27a62e74c Silenced a compiler warning in the sqlite module
Modules/_sqlite/row.c:187: warning: suggest parentheses around && within ||
Reviewed by Benjamin Peterson
2008-08-22 19:55:54 +00:00
Guido van Rossum 93ebfb1544 Issue 1179: [CVE-2007-4965] Integer overflow in imageop module. 2008-08-19 21:02:04 +00:00
Thomas Heller d9ccf8c547 COM method code is windows specific 2008-08-19 19:40:23 +00:00
Thomas Heller 0ad5ae02af Fix a regression introduced by rev. 63792: ctypes function pointers
that are COM methods must have a boolean True value.
2008-08-19 19:25:04 +00:00
Thomas Heller 6626099520 Fix strange character in the docstring. 2008-08-19 17:47:13 +00:00
Benjamin Peterson 7dd854725b get the symtable module back in working order
- Fix broken functions
- Add (hopefully) extensive tests
- Modernize a little
2008-08-17 17:13:26 +00:00
Hirokazu Yamamoto 41a81eb6cb Backport r65661, r65760: Issue #3575: Incremental decoder's decode
function now takes bytearray by using 's*' instead of 't#'.
2008-08-17 13:10:46 +00:00
Hirokazu Yamamoto a0fdd72f8e Issue #2222: Fixed reference leak when occured os.rename()
fails unicode conversion on 2nd parameter. (windows only)
2008-08-17 09:19:52 +00:00
Martin v. Löwis 8401eec7fa Properly INCREF reference in Py_buffer. 2008-08-14 15:56:07 +00:00
Martin v. Löwis f91d46a17d Issue #3139: Make buffer-interface thread-safe wrt. PyArg_ParseTuple,
by denying s# to parse objects that have a releasebuffer procedure,
and introducing s*.

More module might need to get converted to use s*.
2008-08-12 14:49:50 +00:00
Brett Cannon 83e818415a Copy reduce() to _functools so to have functools.reduce() not raise a warning
from usage under -3.
2008-08-09 23:30:55 +00:00
Antoine Pitrou 016b366df4 #3205: bz2 iterator fails silently on MemoryError 2008-08-09 17:22:25 +00:00
Guido van Rossum d69390107a Patch by Ian Charnas from issue 3517.
Add F_FULLFSYNC if it exists (OS X only so far).
2008-08-07 18:51:38 +00:00
Guido van Rossum 8b762f05c7 Tracker issue 3487: sre "bytecode" verifier.
This is a verifier for the binary code used by the _sre module (this
is often called bytecode, though to distinguish it from Python bytecode
I put it in quotes).

I wrote this for Google App Engine, and am making the patch available as
open source under the Apache 2 license.  Below are the copyright
statement and license, for completeness.

# Copyright 2008 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

It's not necessary to include these copyrights and bytecode in the
source file.  Google has signed a contributor's agreement with the PSF
already.
2008-08-05 03:39:21 +00:00
Benjamin Peterson 8df0e4ffc3 fix compile error on Windows 2008-08-02 03:11:16 +00:00
Jesse Noller 1299e36a70 Submit fix for issue3393: Memory corruption in multiprocessing module 2008-08-01 19:46:50 +00:00
Neal Norwitz e7d8be80ba Security patches from Apple: prevent int overflow when allocating memory 2008-07-31 17:17:14 +00:00
Mark Dickinson ff3fdce0d2 Replace math.sum with math.fsum in a couple of comments
that were missed by r65308
2008-07-30 16:25:16 +00:00
Mark Dickinson fef6b13c32 Rename math.sum to math.fsum 2008-07-30 16:20:10 +00:00
Mark Dickinson abe0aee3cf Fix special-value handling for math.sum.
Also minor cleanups to the code: fix tabbing, remove
trailing whitespace, and reformat to fit into 80
columns.
2008-07-30 12:01:41 +00:00
Thomas Heller ba55936b8a Make ctypes compatible with Python 2.3, 2.4, and 2.5 again. 2008-07-24 11:16:45 +00:00
Raymond Hettinger 527eee2b32 Finish conversion from int to Py_ssize_t. 2008-07-24 05:38:48 +00:00
Raymond Hettinger 723ba3049a Parse to the correct datatype. 2008-07-24 00:53:49 +00:00
Raymond Hettinger 33fcf9db74 Finish-up the partial conversion from int to Py_ssize_t for deque indices and length. 2008-07-24 00:08:18 +00:00
Georg Brandl f9efabb6d2 3k-warn about parser's "ast" aliases. 2008-07-23 15:16:45 +00:00
Jesus Cea c5a11fabdb bsddb module updated to version 4.7.2devel9.
This patch publishes the work done until now
for Python 3.0 compatibility. Still a lot
to be done.

When possible, we use 3.0 features in Python 2.6,
easing development and testing, and exposing internal
changes to a wider audience, for better test coverage.

Some mode details:
http://www.jcea.es/programacion/pybsddb.htm#bsddb3-4.7.2
2008-07-23 11:38:42 +00:00
Gregory P. Smith 0470bab697 Issue #2620: Overflow checking when allocating or reallocating memory
was not always being done properly in some python types and extension
modules.  PyMem_MALLOC, PyMem_REALLOC, PyMem_NEW and PyMem_RESIZE have
all been updated to perform better checks and places in the code that
would previously leak memory on the error path when such an allocation
failed have been fixed.
2008-07-22 04:46:32 +00:00
Amaury Forgeot d'Arc 74bd40d85c On Windows, silence a Purify warning and initialize the memory passed to CryptGenRandom.
Since python doesn't provide any particular random data, it seems more reasonable anyway.
2008-07-21 21:06:46 +00:00
Bob Ippolito d648f64a53 #3322: bounds checking for _json.scanstring 2008-07-19 21:59:50 +00:00
Georg Brandl 278fc50c07 #3303: fix crash with invalid Py_DECREF in strcoll(). 2008-07-19 12:46:12 +00:00
Georg Brandl 6b41a8e156 #3302: fix segfaults when passing None for arguments that can't
be NULL for the C functions.
2008-07-19 12:39:10 +00:00
Georg Brandl a24869ada7 #3312: fix two sqlite3 crashes. 2008-07-16 22:33:18 +00:00
Georg Brandl b9b68ae7a5 #3305: self->stream can be NULL. 2008-07-16 22:04:20 +00:00
Georg Brandl 86cbf81b47 #1608818: errno can get set by every call to readdir(). 2008-07-16 21:31:41 +00:00
Thomas Heller 880f529c04 Issue #3313: Contrary to the man page, a failed dlopen() call does not
always set a dlerror() message.
2008-07-15 19:39:38 +00:00
Thomas Heller c0b2a807ff Issue #3258: Fix an assertion error (in debug build) and a crash (in
release build) when the format string of a pointer to an incomplete
structure is created.
2008-07-15 17:03:08 +00:00
Nick Coghlan 53663a695e Issue 2235: __hash__ is once again inherited by default, but inheritance can be blocked explicitly so that collections.Hashable remains meaningful 2008-07-15 14:27:37 +00:00
Gregory P. Smith fb7a50fbb9 Fix posix.fork1() / os.fork1() to only call PyOS_AfterFork() in the child
process rather than both parent and child.

Does anyone actually use fork1()?  It appears to be a Solaris thing
but if Python is built with pthreads on Solaris, fork1() and fork()
should be the same.
2008-07-14 06:06:48 +00:00
Alexandre Vassalotti bd70476897 Issue #3153: sqlite leaks on error.
Changed statements of the form Py_DECREF(obj), obj = 0 to Py_CLEAR(obj).
2008-07-13 21:47:59 +00:00
Robert Schuppenies 4762902998 Added garbage collector overhead and optional default return value to
sys.getsizeof.
2008-07-10 17:13:55 +00:00
Raymond Hettinger 3cd1e42dca Issue 3301: Bisect functions behaved badly when lo was negative. 2008-07-10 14:03:19 +00:00
Facundo Batista 1a664419bb Issue 3306. Better control for a lenght in findmax() function. 2008-07-07 17:02:59 +00:00
Gregory P. Smith 04222925f1 Add commented out #_sha256 and #_sha512 lines per issue 3183. 2008-07-07 04:54:31 +00:00
Gregory P. Smith 3b1e6b2f83 - Issue #3309: Fix bz2.BZFile itererator to release its internal lock
properly when raising an exception due to the bz2file being closed.
  Prevents a deadlock.
2008-07-07 04:31:58 +00:00
Gregory P. Smith eb77fe4cbf fix issue3304 - remove an incorrect PyMem_Free in fileio_init 2008-07-06 17:06:29 +00:00
Gregory P. Smith 2fe77060eb - Issue #2862: Make int and float freelist management consistent with other
freelists.  Changes their CompactFreeList apis into ClearFreeList apis and
  calls them via gc.collect().
2008-07-06 03:35:58 +00:00
Facundo Batista 083902af8f Issue 3289. Removed two lines that ended doing nothing. 2008-07-05 19:19:50 +00:00
Mark Dickinson ecf8d8cc4b Minor rewrite of cmath_log to work around a Sun compiler bug. See issue
#3168.
2008-07-05 15:25:48 +00:00
Amaury Forgeot d'Arc 968117e974 Try a blind fix to nismodule which fails on the solaris10 3.0 buildbot:
the GIL must be re-acquired in the callback function
2008-07-02 23:40:28 +00:00
Amaury Forgeot d'Arc 1f40c8a8d7 #Issue3088 in-progress: Race condition with instances of classes derived from threading.local:
When a thread touches such an object for the first time, a new thread-local __dict__ is created,
and the __init__ method is run.
But a thread switch can occur here; if the other thread touches the same object, it installs another
__dict__; when the first thread resumes, it updates the dictionary of the second...

This is the deep cause of the failures in test_multiprocessing involving "managers" objects.

Also a 2.5 backport candidate.
2008-06-30 22:42:40 +00:00
Facundo Batista 763d309bba Fix #2702, with a correct accounting of recursion. 2008-06-30 01:10:55 +00:00
Bill Janssen 934b16d0c2 various SSL fixes; issues 1251, 3162, 3212 2008-06-28 22:19:33 +00:00
Facundo Batista 68dc052ca6 Reverting the patch from #3165, as it broke other
behaviours. I left the original test commented out (note
that that test came from #2702, which seems to have a
problem in FreeBSD and Windows, but not in Linux).

I included a new test, to watch over the now-broken
behaviour, I took it from #3179.
2008-06-25 19:24:53 +00:00
Thomas Heller b436a24eed Fix compilation on Windows. 2008-06-23 14:49:56 +00:00
Facundo Batista 9da18b3133 Fixing the problem stated in issue 2702 with the patch submitted
in the issue 3165. Now cPickle does not fails with uncontrolled
behaviour when pickling into a very deep nested structure.
2008-06-22 23:19:14 +00:00
Georg Brandl ac0c3810e4 Expand docstrings of sqlite3 functions. 2008-06-22 18:31:54 +00:00
Facundo Batista 1461886eee Issue 3164. Small fix to don't repeat a comparation
without necessity.
2008-06-22 15:27:10 +00:00
Facundo Batista 5596b0cfc2 Issue #2722. Now the char buffer to support the path string has
not fixed length, it mallocs memory if needed. As a result, we
don't have a maximum for the getcwd() method.
2008-06-22 13:36:20 +00:00
Mark Dickinson 2fcd8c9703 Fix another typo in math_sum comment 2008-06-20 15:26:19 +00:00
Andrew M. Kuchling 5f198bee4e Fix comment typos 2008-06-20 02:11:42 +00:00
Andrew M. Kuchling 3d8f8c1d62 Only include update_lines_cols() function when it's actually going to be used 2008-06-19 14:02:30 +00:00
Raymond Hettinger 2281da42b0 Fix double decref. 2008-06-18 00:56:57 +00:00
Mark Dickinson fb1c4b98e9 Issue 3118: make test_math pass on Ubuntu/ia64. exp(-745.0) was raising
OverflowError incorrectly on this platform, presumably as a result of
the libm setting errno = ERANGE for this call.
2008-06-17 21:16:55 +00:00
Amaury Forgeot d'Arc d25cdc370d on windows, r64214 broke compilation with some recent SDKs,
because IPPROTO_IPV6 may be an enumeration member...
2008-06-14 08:36:07 +00:00
Benjamin Peterson dfd79494ce convert multiprocessing to unix line endings 2008-06-13 19:13:39 +00:00
Martin v. Löwis 111c180674 Make more symbols static. 2008-06-13 07:47:47 +00:00
Georg Brandl e1f6646d68 Typo. 2008-06-13 07:08:48 +00:00
Georg Brandl 6d53e7e69c #3095: don't leak values from Py_BuildValue. 2008-06-13 06:56:50 +00:00
Neal Norwitz 705cd06f91 Fix some memory dealloc problems when exceptions occur.
It caused: "Fatal Python error: UNREF invalid object" in the DoubleTest.
2008-06-13 06:02:26 +00:00
Neal Norwitz e9ee44c25b Check for memory alloc failure 2008-06-13 06:00:46 +00:00
Amaury Forgeot d'Arc a4dd2e20e2 Restore support for Microsoft VC6 compiler.
Some functions in the msvcrt module are skipped,
and socket.ioctl is enabled only when using a more recent Platform SDK.

(and yes, there are still companies that use a 10-years old compiler)
2008-06-13 00:42:22 +00:00
Benjamin Peterson 114f7e5fff #1683 prevent forking from interfering in threading storage
This should prevent some test_multiprocessing failures
2008-06-13 00:09:47 +00:00
Georg Brandl 89f48876a2 Add future_builtins.ascii(). 2008-06-11 18:55:38 +00:00
Raymond Hettinger 6fbfb481b8 Optimize previous checkin for heapq. 2008-06-11 12:39:09 +00:00
Raymond Hettinger f0bc3cbdc0 Issue 3051: Let heapq work with either __lt__ or __le__. 2008-06-11 12:06:49 +00:00
Gregory P. Smith 9d53457e59 Merge in release25-maint r60793:
Added checks for integer overflows, contributed by Google. Some are
 only available if asserts are left in the code, in cases where they
 can't be triggered from Python code.
2008-06-11 07:41:16 +00:00
Benjamin Peterson 190d56e009 add the multiprocessing package to fulfill PEP 371 2008-06-11 02:40:25 +00:00
Gregory P. Smith 99a3dce92d More reverting of r63675 per the mailing list discussions. This restores
occurances of PyBytes_ in the code to their original PyString_ names.  The
bytesobject.c file will be renamed back to stringobject.c in a future checkin.
2008-06-10 17:42:36 +00:00
Thomas Heller dcea9a91c6 Add an optional 'offset' parameter to byref, defaultingto zero. 2008-06-10 14:02:46 +00:00
Georg Brandl 8550d69a84 #2536: fix itertools.permutations and itertools.combinations docstrings. 2008-06-10 12:46:39 +00:00
Raymond Hettinger d623414141 Unhappy buildbots. Revert 64052. Long doubles have unexpected effects on some builds. 2008-06-09 11:24:47 +00:00
Raymond Hettinger 7b1ed66372 Address double-rounding scenarios by setting all variables to long doubles. 2008-06-09 09:29:17 +00:00
Raymond Hettinger ecbdd2e9b0 Issue #2138: Add math.factorial(). 2008-06-09 06:54:45 +00:00
Gregory P. Smith dd96db63f6 This reverts r63675 based on the discussion in this thread:
http://mail.python.org/pipermail/python-dev/2008-June/079988.html

Python 2.6 should stick with PyString_* in its codebase.  The PyBytes_* names
in the spirit of 3.0 are available via a #define only.  See the email thread.
2008-06-09 04:58:54 +00:00
Travis E. Oliphant 0144f27602 Remove locking part of new buffer protocol. 2008-06-06 22:39:47 +00:00
Raymond Hettinger ec2fe78d47 Issue 3501: Make heapq support both __le__ and __lt__. 2008-06-06 21:47:51 +00:00
Thomas Heller f89b04c164 Performance improvement: Use PyDict_Get/SetItem instead of
PyDict_Get/SetItemString.
2008-06-06 18:37:55 +00:00
Thomas Heller fbb9c0bf3c Issue #1798: Add ctypes calling convention that allows safe access of errno.
ctypes maintains thread-local storage that has space for two error
numbers: private copies of the system 'errno' value and, on Windows,
the system error code accessed by the GetLastError() and
SetLastError() api functions.

Foreign functions created with CDLL(..., use_errno=True), when called,
swap the system 'errno' value with the private copy just before the
actual function call, and swapped again immediately afterwards.  The
'use_errno' parameter defaults to False, in this case 'ctypes_errno'
is not touched.

On Windows, foreign functions created with CDLL(...,
use_last_error=True) or WinDLL(..., use_last_error=True) swap the
system LastError value with the ctypes private copy.

The values are also swapped immeditately before and after ctypes
callback functions are called, if the callbacks are constructed using
the new optional use_errno parameter set to True: CFUNCTYPE(...,
use_errno=TRUE) or WINFUNCTYPE(..., use_errno=True).

New ctypes functions are provided to access the ctypes private copies
from Python:

- ctypes.set_errno(value) and ctypes.set_last_error(value) store
  'value' in the private copy and returns the previous value.

- ctypes.get_errno() and ctypes.get_last_error() returns the current
  ctypes private copies value.
2008-06-06 08:33:46 +00:00
Thomas Heller 2e75c450d2 Backport from py3k: Implement the new buffer interface from pep3118
for ctypes instances.  Closes issue #2404.
2008-06-05 17:51:15 +00:00
Ronald Oussoren 5640ce2f1e MacOS X: Enable 4-way universal builds
This patch adds a new configure argument on OSX:
        --with-universal-archs=[32-bit|64-bit|all]

When used with the --enable-universalsdk option this controls which
CPU architectures are includes in the framework. The default is 32-bit,
meaning i386 and ppc. The most useful alternative is 'all', which includes
all 4 CPU architectures supported by MacOS X (i386, ppc, x86_64 and ppc64).

This includes limited support for the Carbon bindings in 64-bit mode as well,
limited because (a) I haven't done extensive testing and (b) a large portion
of the Carbon API's aren't available in 64-bit mode anyway.

I've also duplicated a feature of Apple's build of python: setting the
environment variable 'ARCHFLAGS' controls the '-arch' flags used for building
extensions using distutils.
2008-06-05 12:58:24 +00:00
Thomas Heller d5bb9215c9 Revert revisions 63943 and 63942 (Issue #1798: Add ctypes calling
convention that allows safe access to errno)

This code does not yet work on OS X (__thread storage specifier not
available), so i needs a configure check plus a more portable
solution.
2008-06-04 20:22:05 +00:00
Thomas Heller 8f22b88e28 Fix ctypes.set_errno for gcc. 2008-06-04 19:19:00 +00:00
Thomas Heller e70c3378c0 Issue #1798: Add ctypes calling convention that allows safe access to
errno (and LastError, on Windows).

ctypes maintains a module-global, but thread-local, variable that
contains an error number; called 'ctypes_errno' for this discussion.
This variable is a private copy of the systems 'errno' value; the copy
is swapped with the 'errno' variable on several occasions.

Foreign functions created with CDLL(..., use_errno=True), when called,
swap the values just before the actual function call, and swapped
again immediately afterwards.  The 'use_errno' parameter defaults to
False, in this case 'ctypes_errno' is not touched.

The values are also swapped immeditately before and after ctypes
callback functions are called, if the callbacks are constructed using
the new optional use_errno parameter set to True: CFUNCTYPE(..., use_errno=TRUE)
or WINFUNCTYPE(..., use_errno=True).

Two new ctypes functions are provided to access the 'ctypes_errno'
value from Python:

- ctypes.set_errno(value) sets ctypes_errno to 'value', the previous
  ctypes_errno value is returned.

- ctypes.get_errno() returns the current ctypes_errno value.

---

On Windows, the same scheme is implemented for the error value which
is managed by the GetLastError() and SetLastError() windows api calls.

The ctypes functions are 'ctypes.set_last_error(value)' and
'ctypes.get_last_error()', the CDLL and WinDLL optional parameter is
named 'use_last_error', defaults to False.

---

On Windows, TlsSetValue and TlsGetValue calls are used to provide
thread local storage for the variables; ctypes compiled with __GNUC__
uses __thread variables.
2008-06-04 18:59:03 +00:00
Walter Dörwald a2a89a8712 Change all functions that expect one unicode character to accept a pair of
surrogates in narrow builds. Fixes issue #1706460.
2008-06-02 20:36:03 +00:00
Thomas Heller de2d78a153 Fix misspelled sys.platform name and misspelled filename. 2008-06-02 18:41:30 +00:00
Gregory P. Smith 137d824148 Fix issue 2782: be less strict about the format string type in strftime.
Accept unicode and anything else ParseTuple "s#" can deal with.  This
matches the time.strftime behavior.
2008-06-02 04:05:52 +00:00
Martin v. Löwis 99815892f6 New environment variable PYTHONIOENCODING. 2008-06-01 07:20:46 +00:00
Gerhard Häring 7f7ca35f5b Fixed rowcount for SELECT statements. They're -1 now (again), for better DB-API 2.0 compliance. 2008-05-31 21:33:27 +00:00
Raymond Hettinger 6d7702ecd1 Implement heapq in terms of less-than (to match list.sort()). 2008-05-31 03:24:31 +00:00
Raymond Hettinger ef712d6fd3 * Mark intermedidate computes values (hi, lo, yr) as volatile.
* Expand comments.
* Swap variable names in the sum_exact code so that x and y
  are consistently chosen as the larger and smaller magnitude
  values respectively.
2008-05-30 18:20:50 +00:00
Thomas Heller 9287acf83d ctypes NULL function pointers have a boolean False value now. 2008-05-29 19:42:34 +00:00
Thomas Heller a52b244cc1 Fix compiler warning. 2008-05-29 19:18:12 +00:00
Raymond Hettinger 2a9179ac73 Fix two typos. 2008-05-29 08:38:23 +00:00
Gregory P. Smith 572226cad8 Define macros so that this still compiles on Python prior to r63675. 2008-05-26 19:03:35 +00:00
Christian Heimes 593daf545b Renamed PyString to PyBytes 2008-05-26 12:51:38 +00:00
Martin v. Löwis 8c255e4173 Patch #1722225: Support QNX 6. 2008-05-23 15:06:50 +00:00
Raymond Hettinger 778d5cc4fb Tweak the comments and formatting. 2008-05-23 04:32:43 +00:00
Mark Dickinson 99dfe92759 Issue #2819: Add math.sum, a function that sums a sequence of floats
efficiently but with no intermediate loss of precision.  Based on
Raymond Hettinger's ASPN recipe.  Thanks Jean Brouwers for the patch.
2008-05-23 01:35:30 +00:00
Jesus Cea ca3939cd52 bsddb module updated to version 4.7.0 2008-05-22 15:27:38 +00:00
Thomas Heller 03b75ddf7c On HPUX, -fPIC must be used for linking. _ctypes now builds on HP-UX
IA64 and PA machines.

The ctypes unittests work fine on the IA64, but dump core in
test_qsort on the PA.
2008-05-20 19:53:47 +00:00
Georg Brandl dffbf5f542 Revert copy_reg -> copyreg rename. 2008-05-20 07:49:57 +00:00
Gregory P. Smith 664782e1c8 issue2858: Fix potential memory corruption when bsddb.db.DBEnv.lock_get
and other bsddb.db object constructors raised an exception.
Debugging & patch by Neal Norowitz.
2008-05-17 06:12:02 +00:00
Alexandre Vassalotti 3c4971c40e Added Python 3.0 warning to cPickle. 2008-05-16 19:14:31 +00:00
Georg Brandl 5049a858ba #2890: support os.O_ASYNC and fcntl.FASYNC. 2008-05-16 13:10:15 +00:00
Christian Heimes ca21c65a23 Following Amaury's advice 2008-05-16 11:28:56 +00:00
Christian Heimes 0bd23c0a98 Fixed #2870: cmathmodule.c compile error 2008-05-16 10:23:31 +00:00
Brett Cannon 2224817cdf Deprecate sunaudiodev/SUNAUDIODEV for removal in 3.0. 2008-05-16 00:10:24 +00:00
Brett Cannon 4652537ba4 Deprecate imgfile for removal in 3.0. 2008-05-15 03:32:11 +00:00
Brett Cannon 75ba465099 Deprecated 'fm' for removal in 3.0. 2008-05-15 03:23:17 +00:00
Brett Cannon 178582e2a4 FL, flp, and fl from IRIX have been deprecated for removal in 3.0. 2008-05-15 03:20:36 +00:00
Brett Cannon 044616aa24 Deprecate DEVICE, GL, gl, and the related modules cgen and cgensupport for removal in 3.0. 2008-05-15 02:33:55 +00:00
Brett Cannon 650f5161f4 Deprecate CL, CL_old, and cl for 3.0. 2008-05-14 21:12:12 +00:00
Brett Cannon ddf949f194 The CD and cd modules for IRIX are deprecated for 3.0. 2008-05-14 20:31:38 +00:00
Brett Cannon 34721d5683 Deprecate al/AL for removal in 3.0. 2008-05-14 01:08:21 +00:00
Jesus Cea ef9764f1a4 bsddb module updated to version 4.6.4 2008-05-13 18:45:46 +00:00
Brett Cannon bb141bb1f4 Deprecate the timing module for removal in Python 3.0. 2008-05-12 03:47:47 +00:00
Brett Cannon ac861b5a17 Deprecate the sv module as per PEP 4. 2008-05-12 03:45:59 +00:00
Brett Cannon 42bfa90f02 Depreate imageop for removal in 3.0. 2008-05-12 00:08:34 +00:00
Brett Cannon b61d801adb Put Lib/lib-old back on to sys.path for module renames. 2008-05-11 23:39:04 +00:00
Georg Brandl 6a57c08dc8 #1326: document and test zipimporter.archive and zipimporter.prefix. 2008-05-11 15:05:13 +00:00
Alexandre Vassalotti 9510e4a9f8 Added module stub for copy_reg renaming in 3.0.
Renamed copy_reg to copyreg in the standard library, to avoid
spurious warnings and ease later merging to py3k branch. Public
documentation remains intact.
2008-05-11 08:25:28 +00:00
Brett Cannon 7595c1a36b Flesh out the 3.0 deprecation to suggest using the ctypes module. 2008-05-11 01:09:32 +00:00
Brett Cannon df0a717037 The linuxaudidev module has been deprecated for removal in Python 3.0. 2008-05-11 00:50:51 +00:00
Brett Cannon 7f874fce63 Deprecate the dl module for removal in 3.0. 2008-05-10 21:20:19 +00:00
Brett Cannon 768d44f54d Deprecate the bsddb185 module for removal in 3.0. 2008-05-10 02:47:54 +00:00
Brett Cannon 9ac3974de8 Deprecate the pure module for 3.0. 2008-05-09 22:51:58 +00:00
Alexandre Vassalotti 1aed624f7c Backport fast alternate io.BytesIO implementation.
Merged r62778, r62779, r62802, r62806, r62807, r62808, r62809, r62844,
r62846, r62952, r62956.
2008-05-09 21:49:43 +00:00
Mark Dickinson f8476c1573 Issue #2487. math.ldexp(x, n) raised OverflowError when n was large and
negative; fix to return an (appropriately signed) zero instead.
2008-05-09 17:54:23 +00:00
Christian Heimes af748c3ab8 Implemented PEP 370 2008-05-06 22:41:46 +00:00
Christian Heimes c8a0d2f368 Intern static string
Use float constructors instead of magic code for float constants
2008-05-06 16:18:41 +00:00
Brett Cannon 4b964f9c90 Add the 'json' package. Code taken from simplejson 1.9 and contributed by Bob
Ippolito.

Closes issue #2750.
2008-05-05 20:21:38 +00:00
Gerhard Häring e11c9b3dfd Implemented feature request 2157: Converter names are cut off at '('
characters. This avoids the common case of something like 'NUMBER(10)' not
being parsed as 'NUMBER', like expected. Also corrected the docs about
converter names being case-sensitive. They aren't any longer.
2008-05-04 13:42:44 +00:00
Gerhard Häring 5a366c3b8b Applied sqliterow-richcmp.diff patch from Thomas Heller in Issue2152. The
sqlite3.Row type is now correctly hashable.
2008-05-04 13:15:12 +00:00
Gerhard Häring ffa3357d52 SQLite requires 64-bit integers in order to build. So the whole HAVE_LONG_LONG
#ifdefing was useless.
2008-05-04 12:59:57 +00:00
Brett Cannon 8dc4303297 Rename the test_traceback_print() function to traceback_print() to prevent
test_capi from automatically calling the function.
2008-04-28 04:50:06 +00:00
Brett Cannon 141534e56f Fix a bug introduced by the warnings rewrite where tracebacks were being
improperly indented.

Closes issue #2699.
2008-04-28 03:23:50 +00:00
Benjamin Peterson f19a7b90bd A little reformating of Py3k warnings 2008-04-27 18:40:21 +00:00
Benjamin Peterson 9f4f48114f Use PyErr_WarnPy3k throughout 2008-04-27 03:01:45 +00:00
Georg Brandl a6b79f3b11 Add missing return type to dealloc. 2008-04-26 18:32:17 +00:00
Thomas Heller 6ad5fbb7ea Add from_buffer and from_buffer_copy class methods to ctypes types. 2008-04-25 15:44:16 +00:00
Thomas Heller bf027c48c8 Remove cyclic reference in CFuncPtr instances; see issue #2682.
Backport candidate for the release25-maint branch.
2008-04-24 18:14:19 +00:00
Martin v. Löwis 83c9201465 Fix typo. 2008-04-24 13:17:24 +00:00
Mark Dickinson 0da94c8a34 Silence 'r may be used uninitialized' compiler warning. 2008-04-21 01:55:50 +00:00
Mark Dickinson 92483cd8da math.atan2 is misbehaving on Windows; this patch
should fix the problem in the same way that
the cmath.phase problems were fixed.
2008-04-20 21:39:04 +00:00
Mark Dickinson c632301bd4 Even more fixes for alpha Tru64, this time for
the phase and polar methods.
2008-04-20 18:30:05 +00:00
Mark Dickinson 98c317a34d Issue 2662: Initialize special value tables dynamically (i.e. when
cmath module is loaded) instead of statically. This fixes compile-time
problems on platforms where HUGE_VAL is an extern variable rather than
a constant.

Thanks Hirokazu Yamamoto for the patch.
2008-04-20 16:13:17 +00:00
Mark Dickinson cec3f138d8 Yet more explicit special case handling to make
math.pow behave on alpha Tru64.  All IEEE 754
special values are now handled directly; only
the finite**finite case is handled by libm.
2008-04-20 04:13:13 +00:00
Mark Dickinson b2f7090239 FreeBSD doesn't follow C99 for modf(inf); so add explicit
special-value handling to math.modf code.
2008-04-20 01:39:24 +00:00
Mark Dickinson a1293eb65f Additional special-case handling for math.pow.
Windows/VS2008 doesn't like (-1)**(+-inf).
2008-04-19 19:41:52 +00:00
Mark Dickinson e941d97d12 Additional tests for math.pow, and extra special-case
handling code in math.pow, in the hope of making all
tests pass on the alpha Tru64 buildbot.
2008-04-19 18:51:48 +00:00
Christian Heimes 6f34109384 I finally got the time to update and merge Mark's and my trunk-math branch. The patch is collaborated work of Mark Dickinson and me. It was mostly done a few months ago. The patch fixes a lot of loose ends and edge cases related to operations with NaN, INF, very small values and complex math.
The patch also adds acosh, asinh, atanh, log1p and copysign to all platforms. Finally it fixes differences between platforms like different results or exceptions for edge cases. Have fun :)
2008-04-18 23:13:07 +00:00
Thomas Heller 046e6a43ff Issue #2616: Implement ctypes.pointer() and ctypes.POINTER() in C for
better performance.
2008-04-14 16:10:07 +00:00
Georg Brandl 41a0a37c08 Improve -X error message. 2008-04-13 20:50:29 +00:00
Brett Cannon e974689038 Re-implement the 'warnings' module in C. This allows for usage of the
'warnings' code in places where it was previously not possible (e.g., the
parser). It could also potentially lead to a speed-up in interpreter start-up
if the C version of the code (_warnings) is imported over the use of the
Python version in key places.

Closes issue #1631171.
2008-04-12 23:44:07 +00:00
Gregory P. Smith 73bee444ab fix compiler warnings 2008-04-12 20:37:48 +00:00
Christian Heimes 7a98d2730c Applied patch #2617 from Frank Wierzbicki wit some extras from me
-J and -X are now reserved for Jython and non-standard arguments (e.g. IronPython). I've added some extra comments to make sure the reservation don't get missed in the future.
2008-04-12 13:03:03 +00:00
Thomas Heller d3ed492164 Performance improvements. 2008-04-11 14:20:26 +00:00
Thomas Heller 12c4e6478a Move backwards compatibility macro to the correct place;
PyIndex_Check() was introduced in Python 2.5.
2008-04-11 13:05:38 +00:00
Gregory P. Smith 79e42a0e08 Fix zlib crash from zlib.decompressobj().flush(val) when val was not positive.
It tried to allocate negative or zero memory.  That fails.
2008-04-09 00:25:17 +00:00
Amaury Forgeot d'Arc 7adc776ea6 Issue 2408: remove the _types module
It was only used as a helper in types.py to access types (GetSetDescriptorType and MemberDescriptorType),
when they can easily be obtained with python code.
These expressions even work with Jython.

I don't know what the future of the types module is; (cf. discussion in http://bugs.python.org/issue1605 )
at least this change makes it simpler.
2008-04-08 22:07:05 +00:00
Gregory P. Smith c20adf8ef2 Use the new PyFile_IncUseCount & PyFile_DecUseCount calls appropriatly
within the standard library.  These modules use PyFile_AsFile and later
release the GIL while operating on the previously returned FILE*.
2008-04-07 06:33:21 +00:00
Skip Montanaro 28112d0cb6 type 2008-04-06 17:05:57 +00:00
Skip Montanaro 9e0fa7a13e Declare inittimezone static. 2008-04-05 19:47:47 +00:00
Thomas Heller c4ef47611f More files from libffi 3.0.5.
Removed libffi.pc.in because it is not needed for ctypes.
2008-04-04 19:14:42 +00:00
Thomas Heller e1929d5133 Sync with files from the just released libffi 3.0.5 version. 2008-04-04 16:01:54 +00:00
Thomas Heller 8e8ba151dd Issue #2543: Make ctypes compatible (again) with Python 2.3, 2.4, and 2.5. 2008-04-04 08:35:44 +00:00
Guido van Rossum b1ba750226 Remove the advertising clause from the BSD license in timing.h.
I have the email trail to prove that George Neville-Neil approved this.
2008-04-01 23:57:36 +00:00
Georg Brandl 91e0cdaedc Backport #1442: report exception when startup file cannot be run. 2008-03-29 01:50:06 +00:00
Amaury Forgeot d'Arc 94eba715ad Repair compilation for Visual Studio 2005.
I applied the same changes manually to VS7.1 and VC6 files; completely untested.

(Christian, don't try too hard merging this change into py3k.
It will be easier to do the same work again on the branch)
2008-03-28 21:55:29 +00:00
Gerhard Häring 2a11c05b9d Update sqlite3 module to match current version of pysqlite. 2008-03-28 20:08:36 +00:00
Gregory P. Smith b9803421d2 Accept patch issue2426 by Paul Kippes (kippesp).
Adds sqlite3.Connection.iterdump to allow dumping of databases.
2008-03-28 08:32:09 +00:00
Neal Norwitz 5802bb2319 Fix compiler warnings 2008-03-27 05:03:11 +00:00
Georg Brandl 018a3622e8 Fix and simplify error handling, silencing a compiler warning. 2008-03-26 12:57:47 +00:00
Christian Heimes 1a6387e683 Merged revisions 61750,61752,61754,61756,61760,61763,61768,61772,61775,61805,61809,61812,61819,61917,61920,61930,61933-61934 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/trunk-bytearray

........
  r61750 | christian.heimes | 2008-03-22 20:47:44 +0100 (Sat, 22 Mar 2008) | 1 line

  Copied files from py3k w/o modifications
........
  r61752 | christian.heimes | 2008-03-22 20:53:20 +0100 (Sat, 22 Mar 2008) | 7 lines

  Take One
  * Added initialization code, warnings, flags etc. to the appropriate places
  * Added new buffer interface to string type
  * Modified tests
  * Modified Makefile.pre.in to compile the new files
  * Added bytesobject.c to Python.h
........
  r61754 | christian.heimes | 2008-03-22 21:22:19 +0100 (Sat, 22 Mar 2008) | 2 lines

  Disabled bytearray.extend for now since it causes an infinite recursion
  Fixed serveral unit tests
........
  r61756 | christian.heimes | 2008-03-22 21:43:38 +0100 (Sat, 22 Mar 2008) | 5 lines

  Added PyBytes support to several places:
  str + bytearray
  ord(bytearray)
  bytearray(str, encoding)
........
  r61760 | christian.heimes | 2008-03-22 21:56:32 +0100 (Sat, 22 Mar 2008) | 1 line

  Fixed more unit tests related to type('') is not unicode
........
  r61763 | christian.heimes | 2008-03-22 22:20:28 +0100 (Sat, 22 Mar 2008) | 2 lines

  Fixed more unit tests
  Fixed bytearray.extend
........
  r61768 | christian.heimes | 2008-03-22 22:40:50 +0100 (Sat, 22 Mar 2008) | 1 line

  Implemented old buffer interface for bytearray
........
  r61772 | christian.heimes | 2008-03-22 23:24:52 +0100 (Sat, 22 Mar 2008) | 1 line

  Added backport of the io module
........
  r61775 | christian.heimes | 2008-03-23 03:50:49 +0100 (Sun, 23 Mar 2008) | 1 line

  Fix str assignement to bytearray. Assignment of a str of size 1 is interpreted as a single byte
........
  r61805 | christian.heimes | 2008-03-23 19:33:48 +0100 (Sun, 23 Mar 2008) | 3 lines

  Fixed more tests
  Fixed bytearray() comparsion with unicode()
  Fixed iterator assignment of bytearray
........
  r61809 | christian.heimes | 2008-03-23 21:02:21 +0100 (Sun, 23 Mar 2008) | 2 lines

  str(bytesarray()) now returns the bytes and not the representation of the bytearray object
  Enabled and fixed more unit tests
........
  r61812 | christian.heimes | 2008-03-23 21:53:08 +0100 (Sun, 23 Mar 2008) | 3 lines

  Clear error PyNumber_AsSsize_t() fails
  Use CHARMASK for ob_svall access
  disabled a test with memoryview again
........
  r61819 | christian.heimes | 2008-03-23 23:05:57 +0100 (Sun, 23 Mar 2008) | 1 line

  Untested updates to the PCBuild directory
........
  r61917 | christian.heimes | 2008-03-26 00:57:06 +0100 (Wed, 26 Mar 2008) | 1 line

  The type system of Python 2.6 has subtle differences to 3.0's. I've removed the Py_TPFLAGS_BASETYPE flags from bytearray for now. bytearray can't be subclasses until the issues with bytearray subclasses are fixed.
........
  r61920 | christian.heimes | 2008-03-26 01:44:08 +0100 (Wed, 26 Mar 2008) | 2 lines

  Disabled last failing test
  I don't understand what the test is testing and how it suppose to work. Ka-Ping, please check it out.
........
  r61930 | christian.heimes | 2008-03-26 12:46:18 +0100 (Wed, 26 Mar 2008) | 1 line

  Re-enabled bytes warning code
........
  r61933 | christian.heimes | 2008-03-26 13:20:46 +0100 (Wed, 26 Mar 2008) | 1 line

  Fixed a bug in the new buffer protocol. The buffer slots weren't copied into a subclass.
........
  r61934 | christian.heimes | 2008-03-26 13:25:09 +0100 (Wed, 26 Mar 2008) | 1 line

  Re-enabled bytearray subclassing - all tests are passing.
........
2008-03-26 12:49:49 +00:00
Andrew M. Kuchling a8c3f2b6b6 Minor docstring typos 2008-03-26 00:16:50 +00:00
Thomas Heller fffd939056 Make _ctypes.c PY_SSIZE_T_CLEAN. 2008-03-25 21:18:39 +00:00
Georg Brandl 1e7c37514d #2359: add Py3k warning for array.read/array.write. 2008-03-25 08:37:23 +00:00
Gregory P. Smith aef3e529e2 On platforms without zlib, make this do the right thing and return the python
2.x signed value.  Also, don't waste space on a table full of unsigned longs
when all it needs are unsigned ints (incase anyone builds this without zlib on
a 64-bit unix for some strange reason).

tested by forcing it to compile this version on both 32-bit and 64-bit linux.
2008-03-25 07:46:07 +00:00
Gregory P. Smith 1fa588e14f Use a 32-bit unsigned int here, a long is not needed. 2008-03-25 07:31:28 +00:00
Martin v. Löwis b74d084da8 Conditionalize sys/time.h inclusion. 2008-03-24 13:54:23 +00:00
Martin v. Löwis aef18b1c67 Patch #2240: Implement signal.setitimer and signal.getitimer. 2008-03-24 13:31:16 +00:00
Gregory P. Smith 440ca772f3 Have the binascii module use zlib's optimized crc32() function when available
to reduce our code size (1k data table and tiny bit of code).  It falls back
to its own without zlib.
2008-03-24 00:08:01 +00:00
Gregory P. Smith be446b4ab7 replace calls to get the initial values with the raw constants. 2008-03-23 22:14:38 +00:00
Gregory P. Smith 73f57b0c05 Revert r61779 - It undid correct code and caused test_zlib to fail on all
platforms with a 64-bit long.

The Alpha/Tru64 test problem is a problem in either tarfile or test_tarfile,
not zlib.

crc32 and adler32 return 32-bit values.  by using a long thats larger than
32-bits in these functions they were prevented from wrapping around to their
signed 32-bit value that we want them to return in python 2.x.
2008-03-23 20:31:23 +00:00
Neal Norwitz acbd6420e3 Fix test_tarfile failures on Alpha (Tru64). The problem was caused in r61449
which made the return value signed.  On the Alpha that also lost data
since sizeof(int) != sizeof(long) and apparently adler32/crc32 return
64 bits of data.  This change keeps the signedness and continues to store the
data in a long rather than an int as was the case before r61449.
2008-03-23 05:08:37 +00:00
Christian Heimes 0e9ab5f2f0 Applied patch #1657 epoll and kqueue wrappers for the select module
The patch adds wrappers for the Linux epoll syscalls and the BSD kqueue syscalls. Thanks to Thomas Herve and the Twisted people for their support and help.
TODO: Finish documentation documentation
2008-03-21 23:49:44 +00:00
Gregory P. Smith a5cfcad0e3 Prevent ioctl op codes from being sign extended from int to unsigned long
when used on platforms that actually define ioctl as taking an unsigned long.
(the BSDs and OS X / Darwin)

Adds a unittest for fcntl.ioctl that tests what happens with both positive and
negative numbers.

This was done because of issue1471 but I'm not able to reproduce -that- problem
in the first place on Linux 32bit or 64bit or OS X 10.4 & 10.5 32bit or 64 bit.
2008-03-19 23:03:25 +00:00
Raymond Hettinger 0ccfe5f2a0 Remove itertools warnings I had added before the 2-to-3 handled the migration. 2008-03-19 18:01:58 +00:00
Raymond Hettinger 10dca6e282 The filter() function does support a None argument in Py3.0. 2008-03-19 17:58:59 +00:00
David Wolever 2724ab99c8 Added zip, map, filter to future_bultins (#2171) 2008-03-19 02:35:45 +00:00
Gregory P. Smith c856fa811d Add a test to make sure zlib.crc32 and binascii.crc32 return the same thing.
Fix a buglet in binascii.crc32, the second optional argument could previously
have a signedness mismatch with the C variable its going into.
2008-03-18 22:27:41 +00:00
Gregory P. Smith f48da8fbcd Fix chown on 64-bit linux. It needed to take a long (64-bit on 64bit linux) as
uid and gid input to accept values >=2**31 as valid while still accepting
negative numbers to pass -1 to chown for "no change".

Fixes issue1747858.

This should be backported to release25-maint.
2008-03-18 19:05:32 +00:00
Brett Cannon c81d3dc853 Cast the arguments to PyString_AsStringAndSize() to silence compiler warnings
on OS X.
2008-03-18 16:47:51 +00:00
Brett Cannon 10ed0f50a9 Remove all traces of HAVE_STRERROR.
The removal of strerror.c led to the function check being removed from
configure.in.
2008-03-18 15:35:58 +00:00
Thomas Heller 50a24d8bfd Include <alloca.h> on Solaris, see issue #1506.
It would probably be better to have a configure test for that, but
this is outside of my configure expertise.
2008-03-18 15:03:17 +00:00
Neal Norwitz f13572d6e4 Use a buffer large enough to ensure we don't overrun, even if the value
is outside the range we expect.
2008-03-17 19:02:45 +00:00
Gregory P. Smith f48f9d38c0 Force zlib.crc32 and zlib.adler32 to return a signed integer on all platforms
regardless of the native sizeof(long) used in the integer object.

This somewhat odd behavior of returning a signed is maintained in 2.x for
compatibility reasons of always returning an integer rather than a long object.

Fixes Issue1202 for Python 2.6
2008-03-17 18:48:05 +00:00
Skip Montanaro fc070d2731 add %f format to datetime - issue 1158 2008-03-15 16:04:45 +00:00
Thomas Heller 41e22ff5cc Remove unneeded initializer. 2008-03-14 21:06:21 +00:00
Raymond Hettinger 10d7603825 Leave heapreplace() unchanged. 2008-03-14 05:03:44 +00:00
Raymond Hettinger 53bdf09343 Issue 2274: Add heapq.heappushpop(). 2008-03-13 19:03:51 +00:00
Raymond Hettinger 431f029486 Consistent tense. 2008-03-13 16:43:59 +00:00
Raymond Hettinger 10f40a6b5a Add 2-to-3 support for the itertools moved to builtins or renamed. 2008-03-13 16:43:17 +00:00
Raymond Hettinger a1ca94a102 Issue 2246: itertools grouper object did not participate in GC (should be backported). 2008-03-06 22:51:36 +00:00
Raymond Hettinger 6e3e415886 Small code cleanup. 2008-03-05 21:04:32 +00:00
Raymond Hettinger 66f91ea966 C implementation of itertools.permutations(). 2008-03-05 20:59:58 +00:00
Thomas Heller f3c0559b5e Issue 1872: Changed the struct module typecode from 't' to '?', for
compatibility with PEP3118.
2008-03-05 15:34:29 +00:00
Raymond Hettinger f1cca2b593 Fix refleak in chain(). 2008-03-04 22:29:44 +00:00
Thomas Heller a23aede562 Try to fix the build for PY_LINUX. 2008-03-04 20:21:42 +00:00
Thomas Heller 8bdf81d2df Merged changes from libffi3-branch.
The bundled libffi copy is now in sync with the recently released
libffi3.0.4 version, apart from some small changes to
Modules/_ctypes/libffi/configure.ac.

I gave up on using libffi3 files on os x.
Instead, static configuration with files from pyobjc is used.
2008-03-04 20:09:11 +00:00
Raymond Hettinger d553d856e7 Beef-up docs and tests for itertools. Fix-up end-case for product(). 2008-03-04 04:17:08 +00:00
Neal Norwitz ca752f3b1a Only DECREF if ret != NULL 2008-03-03 04:37:45 +00:00
Raymond Hettinger e3fabd10cb Handle 0-tuples which can be singletons. 2008-03-02 12:02:19 +00:00
Raymond Hettinger 61024b9181 Simplify code for itertools.product(). 2008-03-02 11:57:16 +00:00
Gerhard Häring 1cc60ed214 Updated to pysqlite 2.4.1. Documentation additions will come later. 2008-02-29 22:08:41 +00:00
Raymond Hettinger 08ff6822cc Handle the repeat keyword argument for itertools.product(). 2008-02-29 02:21:48 +00:00
Raymond Hettinger b4cbc98c39 Add alternate constructor for itertools.chain(). 2008-02-28 22:46:41 +00:00
Raymond Hettinger 05bf6338b8 Have itertools.chain() consume its inputs lazily instead of building a tuple of iterators at the outset. 2008-02-28 22:30:42 +00:00
Christian Heimes cdddf18768 The empty tuple is usually a singleton with a much higher refcnt than 1 2008-02-28 11:18:49 +00:00
Raymond Hettinger 3bd771263d One too many decrefs. 2008-02-27 01:08:04 +00:00
Raymond Hettinger 93e804da9c Add itertools.combinations(). 2008-02-26 23:40:50 +00:00
Christian Heimes ea837931cf Patch #1691070 from Roger Upole: Speed up PyArg_ParseTupleAndKeywords() and improve error msg
My tests don't show the promised speed up of 10%. The code is as fast as the old code for simple cases and slightly faster for complex cases with several of args and kwargs. But the patch simplifies the code, too.
2008-02-26 17:23:51 +00:00
Christian Heimes aa0ef52ea1 The contains function raised a gcc warning. The new code is copied straight from py3k. 2008-02-26 08:18:11 +00:00
Neal Norwitz b628913b08 Whitespace normalization 2008-02-26 05:12:50 +00:00
Facundo Batista b1d70e2252 Coerced PyBool_Type to be able to compare it. 2008-02-25 23:46:02 +00:00
Raymond Hettinger 9d63837e9b Make sure the itertools filter functions give the same performance for func=bool as func=None. 2008-02-25 22:42:32 +00:00
Facundo Batista df4198915a Issue 2168. gdbm and dbm needs to be iterable; this fixes a
failure in the shelve module.  Thanks Thomas Herve.
2008-02-25 22:33:55 +00:00
Neal Norwitz 114dd944de Fix typo of hexidecimal 2008-02-24 08:27:49 +00:00
Neal Norwitz ed0a593a10 Get ctypes working on the Alpha (Tru64). The problem was that there
were two module_methods and the one used depended on the order the
modules were loaded.  By making the test module_methods static,
it is not exported and the correct version is picked up.
2008-02-24 07:21:56 +00:00
Georg Brandl ebcfd11c16 #1506171: added operator.methodcaller(). 2008-02-23 23:04:35 +00:00
Georg Brandl e2065c65d3 #1826: allow dotted attribute paths in operator.attrgetter. 2008-02-23 23:02:23 +00:00
Christian Heimes f0476e8169 Patch #1957: syslogmodule: Release GIL when calling syslog(3) 2008-02-23 17:42:31 +00:00
Facundo Batista 7e251e83d5 Issue 1089358. Adds the siginterrupt() function, that is just a
wrapper around the system call with the same name.  Also added
test cases, doc changes and NEWS entry. Thanks Jason and Ralf
Schmitt.
2008-02-23 15:07:35 +00:00
Christian Heimes 5224d28d38 Patch #1759: Backport of PEP 3129 class decorators
with some help from Georg
2008-02-23 15:01:05 +00:00
Raymond Hettinger 532316dfa6 Add more comments 2008-02-23 04:03:50 +00:00
Eric Smith a73fbe791d Added future_builtins, which contains PEP 3127 compatible versions of hex() and oct(). 2008-02-23 03:09:44 +00:00
Raymond Hettinger 73d7963242 Improve the implementation of itertools.product()
* Fix-up issues pointed-out by Neal Norwitz.
* Add extensive comments.
* The lz->result variable is now a tuple instead of a list.
* Use fast macro getitem/setitem calls so most code is in-line.
* Re-use the result tuple if available (modify in-place instead of copy).
2008-02-23 02:20:41 +00:00
Raymond Hettinger 50986cc45b First draft for itertools.product(). Docs and other updates forthcoming. 2008-02-22 03:16:42 +00:00
Thomas Heller 981f31860b configure.ac: Remove the configure check for _Bool, it is already done in the
top-level Python configure script.
configure, fficonfig.h.in: regenerated.
2008-02-21 18:28:48 +00:00
Eric Smith a9f7d62480 Backport of PEP 3101, Advanced String Formatting, from py3k.
Highlights:
 - Adding PyObject_Format.
 - Adding string.Format class.
 - Adding __format__ for str, unicode, int, long, float, datetime.
 - Adding builtin format.
 - Adding ''.format and u''.format.
 - str/unicode fixups for formatters.

The files in Objects/stringlib that implement PEP 3101 (stringdefs.h,
unicodedefs.h, formatter.h, string_format.h) are identical in trunk
and py3k.  Any changes from here on should be made to trunk, and
changes will propogate to py3k).
2008-02-17 19:46:49 +00:00
Facundo Batista e139688d34 Issue 2112. mmap does not raises EnvironmentError no more, but
a subclass of it. Thanks John Lenton.
2008-02-17 18:59:29 +00:00
Amaury Forgeot d'Arc 588ff93f13 Crashers of the day: Py_CLEAR must be used when there is a chance that the
function can be called recursively.
This was discussed in issue1020188.

In python codebase, all occurrences of Py_[X]DECREF(xxx->yyy) are suspect,
except when they appear in tp_new or tp_dealloc functions, or when
the member cannot be of a user-defined class.
Note that tp_init is not safe.

I do have a (crashing) example for every changed line.
Is it worth adding them to the test suite?

Example:

class SpecialStr(str):
    def __del__(self):
        s.close()

import cStringIO
s = cStringIO.StringIO(SpecialStr("text"))
s.close() # Segfault
2008-02-16 14:34:57 +00:00
Christian Heimes 7adfad850a Bug #2111: mmap segfaults when trying to write a block opened with PROT_READ
Thanks to Thomas Herve for the fix.
2008-02-15 08:20:11 +00:00
Christian Heimes 3b718a79af Implemented Martin's suggestion to clear the free lists during the garbage collection of the highest generation. 2008-02-14 12:47:33 +00:00
Thomas Heller a06a1a88ee Add pickle support to ctypes types. 2008-02-13 20:21:53 +00:00
Georg Brandl 0a40ffb1b3 #2063: correct order of utime and stime in os.times()
result on Windows.
2008-02-13 07:20:22 +00:00
Raymond Hettinger a37430a0ce dict.copy() rises from the ashes. Revert r60687. 2008-02-12 19:05:36 +00:00
Raymond Hettinger 17a74c395e Add -3 warnings that set.copy(), dict.copy(), and defaultdict.copy() will go away in Py3.x 2008-02-09 04:37:49 +00:00
Hye-Shik Chang 01612e7dec Update big5hkscs codec to conform to the HKSCS:2004 revision. 2008-02-08 17:10:20 +00:00
Amaury Forgeot d'Arc b01aa430d5 issue 2045: Infinite recursion when printing a subclass of defaultdict,
if default_factory is set to a bound method.

Will backport.
2008-02-08 00:56:02 +00:00
Brett Cannon 8352585909 Make sure a switch statement does not have repetitive case statements.
Error found through LLVM post-2.1 svn.
2008-02-07 22:27:10 +00:00
Thomas Heller 55b8c3e26f Fixed refcounts and error handling.
Should not be merged to py3k branch.
2008-02-06 20:29:17 +00:00
Christian Heimes e6a8074892 Another int -> pid_t case 2008-02-03 19:51:13 +00:00
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
Gregory P. Smith fc006692ad * db->get_types is only available in BerkeleyDB >= 4.2
* get compiling with older versions of python again for a stand alone release.
2007-11-05 09:06:28 +00:00
Gregory P. Smith ac11e02143 Add the bsddb.db.DBEnv.lock_id_free method.
Improve test_lock's tempdir creation and cleanup.
2007-11-05 02:56:31 +00:00
Gregory P. Smith ec10a4a402 Fixes bug 477182 on pybsddb.sf.net. DB objects now load the flags and
pay attention to them when opening an existing database.  This means
that d[] behaves properly even on databases previously created with DB_DUP
or DB_DUPSORT flags to allow duplicate keys.

http://sourceforge.net/tracker/index.php?func=detail&aid=477182&group_id=13900&atid=113900

Do not backport, this bugfix could be considered an API change.
2007-11-05 02:32:26 +00:00
Gregory P. Smith aae141a751 Fix bug introduced in revision 58385. Database keys could no longer
have NULL bytes in them.  Replace the errant strdup with a
malloc+memcpy.  Adds a unit test for the correct behavior.
2007-11-01 21:08:14 +00:00
Neal Norwitz 9c4382f2a3 Fix some compiler warnings for signed comparisons on Unix and Windows. 2007-10-31 06:33:20 +00:00
Thomas Heller 469b2a52cd ffi_type_longdouble may be already #defined.
See issue 1324.
2007-10-25 19:47:32 +00:00
Travis E. Oliphant 8feafab346 Add phuang patch from Issue 708374 which adds offset parameter to mmap module. 2007-10-23 02:40:56 +00:00
Thomas Heller 91ac42243c Fix ctypes on 32-bit systems when Python is configured --with-system-ffi.
See also https://bugs.launchpad.net/bugs/72505.

Ported from release25-maint branch.
2007-10-19 18:11:41 +00:00
Neal Norwitz f3ca169bb4 Get this module to compile with bsddb versions prior to 4.3 2007-10-12 03:52:34 +00:00
Neal Norwitz e545ff30a6 Fix Coverity 168: Close the file before returning (exiting). 2007-10-12 03:03:23 +00:00
Neal Norwitz 088beae1f2 Get rid of compiler warning about retval being used (returned) without
being initialized.  (gcc warning and Coverity 202)
2007-10-12 03:01:54 +00:00
Neal Norwitz c740d834ee Get rid of warnings on a bunch of platforms by using a proper prototype. 2007-10-12 03:01:30 +00:00
Raymond Hettinger 68995867d5 Accept Jim Jewett's api suggestion to use None instead of -1 to indicate unbounded deques. 2007-10-10 00:26:46 +00:00
Gregory P. Smith 10bed54ae2 Fix a double free when positioning a database cursor to a non-existant
string key (and probably a few other situations with string keys).
This was reported with a patch as pybsddb sourceforge bug 1708868 by
jjjhhhlll at gmail.
2007-10-09 06:50:43 +00:00
Gregory P. Smith 392505391e Splits Modules/_bsddb.c up into bsddb.h and _bsddb.c and adds a C API
object available as bsddb.db.api.  This is based on the patch submitted
by Duncan Grisby here:
  http://sourceforge.net/tracker/index.php?func=detail&aid=1551895&group_id=13900&atid=313900
See this thread for additional info:
  http://sourceforge.net/mailarchive/forum.php?thread_name=E1GAVDK-0002rk-Iw%40apasphere.com&forum_name=pybsddb-users

It also cleans up the code a little by removing some ifdef/endifs for
python prior to 2.1 and for unsupported Berkeley DB <= 3.2.
2007-10-09 06:02:21 +00:00
Gregory P. Smith e70be5cbb9 Stab in the dark attempt to fix the test_bsddb3 failure on sparc and S-390
ubuntu buildbots.
2007-10-06 07:48:10 +00:00
Raymond Hettinger 556b43d936 Restore BEGIN/END THREADS macros which were squashed in the previous checkin 2007-10-05 19:07:31 +00:00
Neal Norwitz 5a29dd30e0 Fix Coverity #159.
This code was broken if save() returned a negative number since i contained
a boolean value and then we compared i < 0 which should never be true.

Will backport (assuming it's necessary)
2007-10-05 05:01:38 +00:00
Neal Norwitz c47cf7debe dict could be NULL, so we need to XDECREF.
Fix a compiler warning about passing a PyTypeObject* instead of PyObject*.
2007-10-05 03:39:17 +00:00
Raymond Hettinger a7fc4b13e0 Add __asdict__() to NamedTuple and refine the docs.
Add maxlen support to deque() and fixup docs.
Partially fix __reduce__().  The None as a third arg was no longer supported.
Still needs work on __reduce__() to handle recursive inputs.
2007-10-05 02:47:07 +00:00
Raymond Hettinger 50e90e265f itertools.count() no longer limited to sys.maxint. 2007-10-04 00:20:27 +00:00
Sean Reifscheider 8335acbf24 issue1597011: Fix for bz2 module corner-case error due to error checking bug. 2007-09-17 05:45:04 +00:00
Brett Cannon 0153159e67 Add a bunch of GIL release/acquire points in tp_print implementations and for
PyObject_Print().

Closes issue #1164.
2007-09-17 03:28:34 +00:00
Bill Janssen 296a59d3be Add support for asyncore server-side SSL support. This requires
adding the 'makefile' method to ssl.SSLSocket, and importing the
requisite fakefile class from socket.py, and making the appropriate
changes to it to make it use the SSL connection.

Added sample HTTPS server to test_ssl.py, and test that uses it.

Change SSL tests to use https://svn.python.org/, instead of
www.sf.net and pop.gmail.com.

Added utility function to ssl module, get_server_certificate,
to wrap up the several things to be done to pull a certificate
from a remote server.
2007-09-16 22:06:00 +00:00
Guido van Rossum 1ff91d95a2 Patch # 1140 (my code, approved by Effbot).
Make sure the type of the return value of re.sub(x, y, z) is the type
of y+x (i.e. unicode if either is unicode, str if they are both str)
even if there are no substitutions or if x==z (which triggered various
special cases in join_list()).

Could be backported to 2.5; no need to port to 3.0.
2007-09-10 22:02:25 +00:00
Bill Janssen 98d19dafd9 More work on SSL support.
* Much expanded test suite:

  All protocols tested against all other protocols.
  All protocols tested with all certificate options.
  Tests for bad key and bad cert.
  Test of STARTTLS functionality.
  Test of RAND_* functions.

* Fixes for threading/malloc bug.

* Issue 1065 fixed:

  sslsocket class renamed to SSLSocket.
  sslerror class renamed to SSLError.
  Function "wrap_socket" now used to wrap an existing socket.

* Issue 1583946 finally fixed:

  Support for subjectAltName added.
  Subject name now returned as proper DN list of RDNs.

* SSLError exported from socket as "sslerror".

* RAND_* functions properly exported from ssl.py.

* Documentation improved:

  Example of how to create a self-signed certificate.
  Better indexing.
2007-09-10 21:51:02 +00:00
Gregory P. Smith e9fef694b4 Change socket.error to inherit from IOError rather than being a stand
alone class.  This addresses the primary concern in

 http://bugs.python.org/issue1706815

python-dev discussion here:

 http://mail.python.org/pipermail/python-dev/2007-July/073749.html

I chose IOError rather than EnvironmentError as the base class since
socket objects are often used as transparent duck typed file objects
in code already prepared to deal with IOError exceptions.

also a minor fix:

 urllib2 - fix a couple places where IOError was raised rather than URLError.
           for better or worse, URLError already inherits from IOError so
           this won't break any existing code.

 test_urllib2net - replace bad ftp urls.
2007-09-09 23:36:46 +00:00
Gregory P. Smith f80578548d email address update 2007-09-09 20:25:00 +00:00
Thomas Heller 49c7c71d9f Remove unneeded #include. 2007-09-07 09:30:40 +00:00
Thomas Heller 2825b2ea44 Add a 'c_longdouble' type to the ctypes module. 2007-09-07 06:32:17 +00:00
Armin Rigo bddc3416f8 Patch #1733973 by peaker:
ptrace_enter_call() assumes no exception is currently set.
This assumption is broken when throwing into a generator.
2007-09-06 08:30:51 +00:00
Martin v. Löwis d44a4e9719 Patch #786737: Allow building in a tree of symlinks pointing to
a readonly source.
2007-09-05 11:47:34 +00:00
Bill Janssen ffe576dc78 SSL certificate distinguished names should be represented by tuples 2007-09-05 00:46:27 +00:00
Matthias Klose 38336406eb - Fix libffi configure for hppa*-*-linux* | parisc*-*-linux*. 2007-09-04 20:46:02 +00:00
Martin v. Löwis 58bd49f5fe Patch #1388440: Add set_completion_display_matches_hook and
get_completion_type to readline.
2007-09-04 13:13:14 +00:00
Martin v. Löwis af699dd621 Document that we rely on the OS to release the crypto
context. Fixes #1626801.
2007-09-04 09:51:57 +00:00
Thomas Wouters dcb3c382ac Somewhat-preliminary slice-object and extended slicing support for ctypes.
The exact behaviour of omitted and negative indices for the Pointer type may
need a closer look (especially as it's subtly different from simple slices)
but there's time yet before 2.6, and not enough before 3.0a1 :-)
2007-08-30 21:01:17 +00:00
Thomas Wouters 3ccec68a05 Improve extended slicing support in builtin types and classes. Specifically:
- Specialcase extended slices that amount to a shallow copy the same way as
   is done for simple slices, in the tuple, string and unicode case.

 - Specialcase step-1 extended slices to optimize the common case for all
   involved types.

 - For lists, allow extended slice assignment of differing lengths as long
   as the step is 1. (Previously, 'l[:2:1] = []' failed even though
   'l[:2] = []' and 'l[:2:None] = []' do not.)

 - Implement extended slicing for buffer, array, structseq, mmap and
   UserString.UserString.

 - Implement slice-object support (but not non-step-1 slice assignment) for
   UserString.MutableString.

 - Add tests for all new functionality.
2007-08-28 15:28:19 +00:00
Guido van Rossum 780b80dc08 > Some of the code sets the error string in this directly before
> returning NULL, and other pieces of the code call PySSL_SetError,
> which creates the error string.  I think some of the places which set
> the string directly probably shouldn't; instead, they should call
> PySSL_SetError to cons up the error name directly from the err code.
> However, PySSL_SetError only works after the construction of an ssl
> object, which means it can't be used there...  I'll take a longer look
> at it and see if there's a reasonable fix.

Here's a patch which addresses this.  It also fixes the indentation in
PySSL_SetError, bringing it into line with PEP 7, fixes a compile warning
about one of the OpenSSL macros, and makes the namespace a bit more
consistent.  I've tested it on FC 7 and OS X 10.4.

% ./python ./Lib/test/regrtest.py -R :1: -u all test_ssl
test_ssl
beginning 6 repetitions
123456
......
1 test OK.
[29244 refs]
%

[GvR: slightly edited to enforce 79-char line length, even if it required
 violating the style guide.]
2007-08-27 18:42:23 +00:00
Neal Norwitz dc988119b5 Fix a few more variables to try to get this to compile with Visual Studio. 2007-08-25 16:58:09 +00:00
Neal Norwitz 049da9e1cf Try to get this to build with Visual Studio by moving all the variable
declarations to the beginning of a scope.
2007-08-25 16:41:36 +00:00
Guido van Rossum 4f2c3ddca4 Server-side SSL and certificate validation, by Bill Janssen.
While cleaning up Bill's C style, I may have cleaned up some code
he didn't touch as well (in _ssl.c).
2007-08-25 15:08:43 +00:00
Nick Coghlan 1a42ece0c7 Fix bug 1764407 - the -i switch now does the right thing when using the -m switch 2007-08-25 10:50:41 +00:00
Hye-Shik Chang 2390104d81 Add cheot-ga-keut composed make-up sequence support in EUC-KR codec. 2007-08-20 06:49:18 +00:00
Walter Dörwald 6e39080649 Backport r57105 and r57145 from the py3k branch: UTF-32 codecs. 2007-08-17 16:41:28 +00:00
Neal Norwitz 91a57216c9 Fix memory leak in os.readlink 2007-08-12 17:11:13 +00:00
Guido van Rossum b5e81aa53e Backport r56875 from py3k; double LEAVE_PYTHON when AsString() fails
in PythonCmd().
2007-08-09 21:47:11 +00:00
Georg Brandl 95d94947f0 Fix compilation warning. 2007-08-08 13:50:02 +00:00
Georg Brandl 9616444427 Revert the fix for #1548891, it broke backwards compatibility with arbitrary read buffers.
Fixes #1730114.
2007-08-08 13:03:41 +00:00