Commit Graph

4661 Commits

Author SHA1 Message Date
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