Commit Graph

5157 Commits

Author SHA1 Message Date
Matthias Klose 0d948ac90c - Expat: Fix DoS via XML document with malformed UTF-8 sequences
(CVE_2009_3560).
2010-01-22 00:39:04 +00:00
Gregory P. Smith 6b3573009a Do not compile stubs for the sha2 series hashes in the openssl hashlib
module when the openssl version is too old to support them.  That
leads both compiled code bloat and to unittests attempting to test
implementations that don't exist for comparison purposes on such
platforms.
2010-01-19 08:19:03 +00:00
Ronald Oussoren a55af9a9db - Issue #7658: Ensure that the new pythonw executable works on OSX 10.4
- Issue #7714: Use ``gcc -dumpversion`` to detect the version of GCC on
  MacOSX.

- Make configure look for util.h as well as libutil.h. The former
  is the header file that on OSX contains the defition of openpty.

  (Needed to compile for OSX 10.4 on OSX 10.6)

- Use the correct definition of CC to compile the pythonw executable
2010-01-17 16:25:57 +00:00
Antoine Pitrou db983a7c38 Followup to #7703: a2b_hqx() didn't follow the new buffer API (neither in trunk
nor in py3k).  Patch by Florent Xicluna as well as additional tests.
2010-01-16 17:45:56 +00:00
Antoine Pitrou c391ad007b Issue #7701: Fix crash in binascii.b2a_uu() in debug mode when given a
1-byte argument.  Patch by Victor Stinner.
2010-01-15 00:18:00 +00:00
Antoine Pitrou efdddd3370 Issue #3299: Fix possible crash in the _sre module when given bad
argument values in debug mode.  Patch by Victor Stinner.
2010-01-14 17:25:24 +00:00
Antoine Pitrou fd3a60d5ef Issue #7703: Add support for the new buffer API to functions of the
binascii module.  Backported from py3k by Florent Xicluna, with some
additional tests.
2010-01-14 16:27:09 +00:00
Antoine Pitrou 8c510e704e Issue #7661: Allow ctypes to be built from a non-ASCII directory path.
Patch by Florent Xicluna.
2010-01-13 11:47:49 +00:00
Alexandre Vassalotti b646547bb4 Issue #2333: Backport set and dict comprehensions syntax. 2010-01-11 22:36:12 +00:00
Alexandre Vassalotti ee936a2130 Issue #2335: Backport set literals syntax from Python 3.x. 2010-01-09 23:35:54 +00:00
Antoine Pitrou 8015725d4f Issue #7092: Remove py3k warning when importing cPickle. 2to3 handles
renaming of `cPickle` to `pickle`.  The warning was annoying since there's
no alternative to cPickle if you care about performance.  Patch by Florent
Xicluna.
2010-01-08 19:20:17 +00:00
Antoine Pitrou 0d423b870b Issue #7455: Fix possible crash in cPickle on invalid input. Patch by
Florent Xicluna.
2010-01-07 17:46:49 +00:00
Gregory P. Smith 3b18ff7e8b remove an obsolete file that should've gone with r77252 2010-01-03 14:56:28 +00:00
Mark Dickinson f132c16199 Make use of PyLong_AsLongAndOverflow in math_ldexp. 2010-01-03 12:03:03 +00:00
Gregory P. Smith 443ec6875f Issue #3745: Undo the requirement for new buffer API only objects to be passed
to hashlib functions in python 2.x.  The module now uses the 's*' for argument
parsing which auto encodes unicode objects to the system default encoding for
us.
2010-01-02 22:28:48 +00:00
Mark Dickinson d3e323215c Refactor some longobject internals: PyLong_AsDouble and _PyLong_AsScaledDouble
(the latter renamed to _PyLong_Frexp) now use the same core code.  The
exponent produced by _PyLong_Frexp now has type Py_ssize_t instead of the
previously used int, and no longer needs scaling by PyLong_SHIFT.  This
frees the math module from having to know anything about the PyLong
implementation.  This closes issue #5576.
2010-01-02 14:45:40 +00:00
Georg Brandl 8cdc9bc901 More yearly updates. 2010-01-01 13:07:05 +00:00
Ezio Melotti aac4df68d8 #7613: missing ) in flmodule.c 2009-12-31 13:47:24 +00:00
Amaury Forgeot d'Arc 8645a5c81f #7413: Passing '\0' as the separator to datetime.datetime.isoformat()
used to drop the time part of the result.
2009-12-29 22:03:38 +00:00
Georg Brandl fa1ffb69c4 #7595: fix typo in argument default constant. 2009-12-29 21:09:17 +00:00
Georg Brandl 740cdc3a9f #7033: add new API function PyErr_NewExceptionWithDoc, for easily giving new exceptions a docstring. 2009-12-28 08:34:58 +00:00
Amaury Forgeot d'Arc 2401c03746 Fix a typo in comment 2009-12-27 20:06:44 +00:00
Gregory P. Smith 9f12d468f4 Fix possible integer overflow in lchown and fchown functions. For issue1747858. 2009-12-23 09:31:11 +00:00
Mark Dickinson 1730fdc130 Inverse hyperbolic trigonometric functions should call m_log1p, not log1p. 2009-12-21 15:40:33 +00:00
Mark Dickinson 12748b003c Issue #7518: Move substitute definitions of C99 math functions from
pymath.c to Modules/_math.c.
2009-12-21 15:22:00 +00:00
Mark Dickinson bd335bfce7 Additional edge-case tests for test_long_and_overflow. 2009-12-21 12:15:48 +00:00
Mark Dickinson ed02b3f342 Fix reference counts for test_long_and_overflow. 2009-12-21 11:31:54 +00:00
Mark Dickinson e31d300664 Issue #7528: Backport PyLong_AsLongAndOverflow from py3k to trunk.
Thanks Case Van Horsen for the patch.
2009-12-21 11:21:25 +00:00
Mark Dickinson b5e348b305 Add missing tests for PyArg_Parse* with format 'h' 2009-12-20 15:57:56 +00:00
Mark Dickinson 5698977186 math.factorial depends on PyLong_AsLong correctly converting floats; rewrite
it to do the conversion explicitly instead.  See issue #7550.
2009-12-20 13:58:18 +00:00
Antoine Pitrou e812d29b52 Issue #7545: improve documentation of the `buffering` argument in io.open(). 2009-12-19 21:01:10 +00:00
Mark Dickinson 5ff37ae14b Issue #3366: Add error function and complementary error function to
math module.
2009-12-19 11:07:23 +00:00
Mark Dickinson 9cae178f21 Issue #3366: Add expm1 function to math module. Thanks Eric Smith for
testing on Windows.
2009-12-16 20:13:40 +00:00
Benjamin Peterson 001e4a6c07 add a test of loading the datetime capi 2009-12-13 21:27:53 +00:00
Benjamin Peterson aef189939e remove unused variable 2009-12-13 19:27:02 +00:00
Benjamin Peterson ddd392cbb9 accept None as the same as having passed no argument in file types #7349
This is for consistency with imitation file objects like StringIO and BytesIO.

This commit also adds a few tests, where they were lacking for concerned
methods.
2009-12-13 19:19:07 +00:00
Mark Dickinson 9be87bc992 Issue #3366: Add lgamma function to math module. 2009-12-11 17:29:33 +00:00
Raymond Hettinger a5fd24e97d Add a reverse() method to collections.deque(). 2009-12-10 06:42:54 +00:00
Raymond Hettinger 0b3263b073 Fix variants of deque.extend: d.extend(d) d+=d d.extendleft(d) 2009-12-10 06:00:33 +00:00
Antoine Pitrou 187177fc55 Issue #6986: Fix crash in the JSON C accelerator when called with the
wrong parameter types.  Patch by Victor Stinner.
2009-12-08 15:40:51 +00:00
Antoine Pitrou 30b3b35cba Issue #7333: The `posix` module gains an `initgroups()` function providing
access to the initgroups(3) C library call on Unix systems which implement
it.  Patch by Jean-Paul Calderone.
2009-12-02 20:37:54 +00:00
Amaury Forgeot d'Arc d728871ee1 #7419: Fix a crash on Windows in locale.setlocale() when the category
is outside the allowed range.
2009-12-01 21:51:04 +00:00
Raymond Hettinger 9b4197ba53 Handle step values other than one. 2009-11-30 21:13:52 +00:00
Raymond Hettinger e09f45a2e3 Issue 7410: deepcopy of itertools.count resets the count 2009-11-30 19:44:40 +00:00
Mark Dickinson 5afa6d4dcf Issue #7272, continued: don't re-use existing HAVE_BROKEN_POSIX_SEMAPHORES
to indicate that semaphores aren't available;  define a new variable
POSIX_SEMAPHORES_NOT_ENABLED instead.
2009-11-28 10:44:20 +00:00
Martin v. Löwis 50ea4565bd Issue #6508: Add posix.{getresuid,getresgid,setresuid,setresgid}. 2009-11-27 13:56:01 +00:00
Antoine Pitrou bcfaf8007d Issue #5788: `datetime.timedelta` objects get a new `total_seconds()` method returning
the total number of seconds in the duration.  Patch by Brian Quinlan.
2009-11-25 22:59:36 +00:00
Mark Dickinson 889d96455a Issue #7228: Fix format mismatch when printing something of type off_t.
(Should silence some compiler warnings.)
2009-11-24 20:51:48 +00:00
Alexandre Vassalotti 8b2d713d32 Issue 7128: Removed reference to the non-existent copyreg module.
The reference to copyreg was a unnoticed leftover from the compatibility
support for the grand renaming of the standard library in Python 3. The
compatibility support was reverted in r63493, but not completely as this
patch shows.

Based on a patch by Amaury Forgeot d'Arc.
2009-11-24 17:53:23 +00:00
Mark Dickinson c4920e86ef Issue #7272: Add configure test to detect whether sem_open works
properly, and use this to skip test_multiprocessing on platforms
where sem_open raises a signal.  This should fix some FreeBSD buildbot
failures for test_multiprocessing.
2009-11-20 19:30:22 +00:00
Raymond Hettinger 9eac119ba8 Fix docstrings for itertools combinatoric functions. 2009-11-19 01:22:04 +00:00
Mark Dickinson 82864d1ab1 Issue #7228: Add '%lld' and '%llu' support to PyFormat_FromString,
PyFormat_FromStringV and PyErr_Format.
2009-11-15 16:18:58 +00:00
Antoine Pitrou 323b9da16d Issue #7211: Allow 64-bit values for the `ident` and `data` fields of kevent
objects on 64-bit systems.  Patch by Michael Broghton.

I will revert this checkin if it causes problems on our BSD buildbots.
2009-11-04 19:25:14 +00:00
Georg Brandl efc285880c #7259: show correct equivalent for operator.i* operations in docstring; fix minor issues in operator docs. 2009-11-04 07:38:12 +00:00
Raymond Hettinger fa7dadd339 Fix exception handling in itertools.izip_longest(). 2009-11-01 20:45:16 +00:00
Antoine Pitrou e50efaad9f Buffered I/O: optimize lock taking in the common non-contended case. 2009-11-01 11:58:22 +00:00
Gregory P. Smith b2b92ea7bc Define TCSASOFT if the flag exists. 2009-10-31 21:23:39 +00:00
Antoine Pitrou 2c970a2ba2 Remove official documentation entry for thread._count() and make the
docstring more descriptive instead.
2009-10-30 22:19:09 +00:00
Antoine Pitrou 59c44f36e0 Issue #7222: Make thread "reaping" more reliable so that reference
leak-chasing test runs give sensible results. The previous method of
reaping threads could return successfully while some Thread objects were
still referenced. This also introduces a new private function:
:func:hread._count().
2009-10-30 17:07:08 +00:00
Georg Brandl a8f8bed203 Use a single style for all the docstrings in the math module. 2009-10-29 20:54:03 +00:00
Georg Brandl 40777e6606 Use the correct function name in docstring. 2009-10-29 20:38:32 +00:00
Mark Dickinson 3ddb52717f Roll back ill-considered attempts to fix printf specifier mismatch for off_t.
The sensible solution seems to be to implement %lld for PyString_FromFormat(V)
and PyErr_Format.  See issue #7228.
2009-10-29 09:46:04 +00:00
Eric Smith 129c97df02 Issue 7117: Replace PyOS_ascii_strtod with PyOS_string_to_double in _json.c as part of short float repr. Change made after consulting with Bob Ippolito. This completes the removal of calls to PyOS_ascii_strtod. 2009-10-28 08:44:37 +00:00
Mark Dickinson e8486931b6 Fix format specifier for MSVC 2009-10-28 07:47:32 +00:00
Mark Dickinson 791181b0ff Replace long long with PY_LONG_LONG 2009-10-28 07:23:49 +00:00
Mark Dickinson bf1039d98c Silence gcc warnings when trying to print an off_t using "lld", on platforms
where off_t has type long (e.g., 64-bit Linux).
2009-10-27 21:48:20 +00:00
Antoine Pitrou dd62966a5f Issue #7205: Fix a possible deadlock when using a BZ2File object from several threads at once. 2009-10-27 17:41:58 +00:00
Eric Smith b53e1a6ed3 Issue 7117: Replace PyOS_ascii_strtod with PyOS_string_to_double in stropmodule as part of short float repr. 2009-10-27 12:12:44 +00:00
Eric Smith 97be1ca1d9 Issue 7117: Replace PyOS_ascii_strtod with PyOS_string_to_double in cPickle as part of short float repr. 2009-10-27 11:32:11 +00:00
Mark Dickinson e052b64def Use correct conversion specifier and length modifier when printing an
integer of type off_t.  Also, don't assume that long long is available.
2009-10-26 19:59:23 +00:00
Antoine Pitrou d9ff74e51d Some platforms have rl_completion_append_character but not rl_completion_suppress_append.
Reported by Mark D.
2009-10-26 19:16:46 +00:00
Eric Smith b05d3be2f1 Continue removing _PyOS_double_to_string, as mentioned in issue 7117. 2009-10-26 15:06:39 +00:00
Antoine Pitrou 5e9f6676ea Fix compilation error in debug mode. 2009-10-24 12:41:27 +00:00
Antoine Pitrou f7820c1626 Manual py3k backport: [svn r74316] Issue #5449: Fix io.BytesIO to not accept arbitrary keywords 2009-10-24 12:28:22 +00:00
Antoine Pitrou fa94e80f3b Manual py3k backport: [svn r74158] Issue #6218: Make io.BytesIO and io.StringIO picklable. 2009-10-24 12:23:18 +00:00
Antoine Pitrou f98a267be3 Manual py3k backport: [svn r74155] Issue #6242: Fix deallocator of io.StringIO and io.BytesIO 2009-10-24 11:59:41 +00:00
Antoine Pitrou efb60c0ceb Issue #1722344: threading._shutdown() is now called in Py_Finalize(), which
fixes the problem of some exceptions being thrown at shutdown when the
interpreter is killed. Patch by Adam Olsen.
2009-10-20 21:29:37 +00:00
Antoine Pitrou 119cdef9b4 Issue #5833: Fix extra space character in readline completion with the
GNU readline library version 6.0.
2009-10-19 18:17:18 +00:00
Antoine Pitrou 5ba84910ae Issue #7133: SSL objects now support the new buffer API.
This fixes the test_ssl failure.
2009-10-19 17:59:07 +00:00
Georg Brandl e363b1434d Fix refleaks in _ctypes PyCSimpleType_New, which fixes the refleak seen in test___all__. 2009-10-17 08:57:43 +00:00
Neil Schemenauer 973f8b4ca6 Make cPickle.Unpickler.noload() handle dict subclasses. noload() is
an obscure, undocumentated feature so no test was added. Closes
issue #1101399.
2009-10-14 19:33:31 +00:00
Mark Dickinson 3d830828de Issue #7078: _struct.__doc__ was being ignored. Import it into struct.
Also add description of '?' struct format character.  Thanks Gabriel
Genellina for the patch.
2009-10-08 15:54:10 +00:00
Amaury Forgeot d'Arc d0052d17b1 #1571184: makeunicodedata.py now generates the functions _PyUnicode_ToNumeric,
_PyUnicode_IsLinebreak and _PyUnicode_IsWhitespace.

It now also parses the Unihan.txt for numeric values.
2009-10-06 19:56:32 +00:00
Amaury Forgeot d'Arc 3de4647022 Fix compilation warning on Windows, where size_t is 32bit but file offsets are 64bit. 2009-10-05 20:18:05 +00:00
Philip Jenvey dbf3b258e7 #6990: clear threading.local's key only after its thread state is removed:
fixes local subclasses leaving old state around after a ref cycle GC which
could be recycled by new locals
2009-09-29 04:32:44 +00:00
Mark Dickinson b93fff0a57 Issue #3366: Add gamma function to math module.
(lgamma, erf and erfc to follow).
2009-09-28 18:54:55 +00:00
Mark Dickinson 716a9ccd3d Eliminate unnecessary get_wrapped_(u)long defines in struct module. 2009-09-27 16:39:28 +00:00
Andrew M. Kuchling b49e53ee16 #6243: fix segfault when keyname() returns a NULL pointer.
Bug noted by Trundle, patched by Trundle and Jerry Chen.
2009-09-25 22:23:54 +00:00
Kristján Valur Jónsson 2fcd03bb77 http://bugs.python.org/issue6971
Adding the SIO_KEEPALIVE_VALS command to socket.ioctl on windows
2009-09-25 15:19:51 +00:00
Brett Cannon 6ef9fd7c97 Fix whitespace. 2009-09-22 19:13:27 +00:00
Brett Cannon 4d94743c28 When range checking was added to time.strftime() a check was placed on tm_isdst
to make sure it fell within [-1, 1] just in case someone implementing
strftime() in libc was stupid enough to assume this. Turns out, though, some
OSs (e.g. zOS) are stupid enough to use values outside of this range for time
structs created by the system itself. So instead of throwing a ValueError,
tm_isdst is now normalized before being passed to strftime().

Fixes issue #6823. Thanks Robert Shapiro for diagnosing the problem and
contributing an initial patch.
2009-09-22 00:29:48 +00:00
Antoine Pitrou 2a46658bee Issue #6236, #6348: Fix various failures in the io module under AIX
and other platforms, when using a non-gcc compiler. Patch by egreen.

In addition, I made explicit the signedness of all bitfields in the
IO library.
2009-09-21 21:17:48 +00:00
Ronald Oussoren 16766d7cd6 Merge a newer version of libffi_osx, based on the
version of libffi in OSX 10.6.1.

This fixes issue6918
2009-09-20 18:54:16 +00:00
Ronald Oussoren 9f20d9d0ee Issue 6877: this patch makes it possible to link the readline extension
to the libedit emulation of the readline API on OSX 10.5 or later.

This also adds a minimal testsuite for readline to check that the
history manipuation functions have the same interface with both
C libraries.
2009-09-20 14:18:15 +00:00
Thomas Heller d25fb2ff1f Remove unused variable and static function to fix compiler warnings. 2009-09-19 10:04:54 +00:00
Georg Brandl ab849891ef #6944: the argument to PyArg_ParseTuple should be a tuple, otherwise a SystemError is set. Also clean up another usage of PyArg_ParseTuple. 2009-09-19 07:35:07 +00:00
Thomas Heller 6be522bfc2 Issue #4606: Passing 'None' if ctypes argtype is set to POINTER(...)
does now always result in NULL.
2009-09-18 20:05:44 +00:00
Thomas Heller 7a352c0ed8 Issue #5042: Structure sub-subclass does now initialize correctly with
base class positional arguments.
2009-09-18 18:55:17 +00:00
Mark Dickinson 4676048b43 Remove outdated include; this include was breaking OS X builds using
non-Apple gcc4.3 and gcc4.4 (because CoreFoundation/CoreFoundation.h
won't compile under non-Apple gcc).
2009-09-16 20:26:31 +00:00
Thomas Wouters c4dcb3801e Fix issue #1590864, multiple threads and fork() can cause deadlocks, by
acquiring the import lock around fork() calls. This prevents other threads
from having that lock while the fork happens, and is the recommended way of
dealing with such issues. There are two other locks we care about, the GIL
and the Thread Local Storage lock. The GIL is obviously held when calling
Python functions like os.fork(), and the TLS lock is explicitly reallocated
instead, while also deleting now-orphaned TLS data.

This only fixes calls to os.fork(), not extension modules or embedding
programs calling C's fork() directly. Solving that requires a new set of API
functions, and possibly a rewrite of the Python/thread_*.c mess. Add a
warning explaining the problem to the documentation in the mean time.

This also changes behaviour a little on AIX. Before, AIX (but only AIX) was
getting the import lock reallocated, seemingly to avoid this very same
problem. This is not the right approach, because the import lock is a
re-entrant one, and reallocating would do the wrong thing when forking while
holding the import lock.

Will backport to 2.6, minus the tiny AIX behaviour change.
2009-09-16 19:55:54 +00:00