Commit Graph

6728 Commits

Author SHA1 Message Date
Larry Hastings 67cbf7bff9 Issue #14626: Fix buildbot issue on x86 Tiger 3.x. 2012-06-22 17:06:48 -07:00
Larry Hastings 9cf065cfdc Issue #14626: Large refactoring of functions / parameters in the os module.
Many functions now support "dir_fd" and "follow_symlinks" parameters;
some also support accepting an open file descriptor in place of of a path
string.  Added os.support_* collections as LBYL helpers.  Removed many
functions only previously seen in 3.3 alpha releases (often starting with
"f" or "l", or ending with "at").  Originally suggested by Serhiy Storchaka;
implemented by Larry Hastings.
2012-06-22 16:30:09 -07:00
Stefan Krah 3077ab8237 Whitespace. 2012-06-23 00:31:04 +02:00
Alexander Belopolsky 93c9cd07b6 Issue #9527: tm_gmtoff has 'correct' sign. 2012-06-22 16:04:19 -04:00
Antoine Pitrou 5f6213be2d Merge 2012-06-22 21:13:34 +02:00
Antoine Pitrou f7338f65fb Add forgotten files for #14837. 2012-06-22 21:12:59 +02:00
Antoine Pitrou 3b36fb1f53 Issue #14837: SSL errors now have `library` and `reason` attributes describing precisely what happened and in which OpenSSL submodule.
The str() of a SSLError is also enhanced accordingly.

NOTE: this commit creates a reference leak.  The leak seems tied to the
use of PyType_FromSpec() to create the SSLError type.  The leak is on the
type object when it is instantiated:

>>> e = ssl.SSLError()
>>> sys.getrefcount(ssl.SSLError)
35
>>> e = ssl.SSLError()
>>> sys.getrefcount(ssl.SSLError)
36
>>> e = ssl.SSLError()
>>> sys.getrefcount(ssl.SSLError)
37
2012-06-22 21:11:52 +02:00
Kristjan Valur Jonsson 69cf913ba1 Issue #15124: Optimize _thread.LockType deletion and acquisition when
not contested, similar to what _thread.RLock already has.
2012-06-22 18:40:02 +00:00
Alexander Belopolsky 878054e97b Fixed compiler warnings in datetime_astimezone() 2012-06-22 14:11:58 -04:00
Alexander Belopolsky 31227ca514 Issue #9527: Fixes for platforms without tm_zone 2012-06-22 13:23:21 -04:00
Jesus Cea 9436361e4c Closes #10142: Support for SEEK_HOLE/SEEK_DATA 2012-06-22 18:32:07 +02:00
Alexander Belopolsky fdc860f310 Issue #9527: datetime.astimezone() method will now supply a class
timezone instance corresponding to the system local timezone when
called with no arguments.
2012-06-22 12:23:23 -04:00
Larry Hastings 8f904daee9 Issue #14769: test_capi now has SkipitemTest, which cleverly checks
for "parity" between PyArg_ParseTuple() and the Python/getargs.c static
function skipitem() for all possible "format units".
2012-06-22 03:56:29 -07:00
Hynek Schlawack 7f59fd7c7c Simplify code in fileio_init
If an identical code line is in both at the end of if and else, it can as well
stand after the block. :) The code is from 464cf523485e, I didn't see it before
checking the commits in the web interface of course.
2012-06-22 09:32:22 +02:00
Nadeem Vawda 2180c97a00 Document the rest of zlib.compressobj()'s arguments.
Original patch by Jim Jewett; see issue 14684.
2012-06-22 01:40:49 +02:00
Nadeem Vawda cf5e1d82e3 Tidy up comments from dd4f7d5c51c7 (zlib compression dictionary support). 2012-06-22 00:35:57 +02:00
Nadeem Vawda a425c3d5a2 Make lzma.{encode,decode}_filter_properties private.
These functions were originally added to support LZMA compression in the zipfile
module, and are not of interest for the majority of users.

They can be made public in 3.4 if there is user interest, but in the meanwhile,
I've opted to present a smaller, simpler API for the module's initial release.
2012-06-21 23:36:48 +02:00
Hynek Schlawack 69168354c2 #10053: Don't close FDs when FileIO.__init__ fails
Loosely based on the work by Hirokazu Yamamoto.
2012-06-21 20:58:31 +02:00
Hynek Schlawack 9ed8b4e4ca #10053: Don't close FDs when FileIO.__init__ fails
Loosely based on the work by Hirokazu Yamamoto.
2012-06-21 20:20:25 +02:00
doko@ubuntu.com c2b4673ffe md5_{init,process,done}: make static 2012-06-21 17:26:06 +02:00
doko@ubuntu.com 1e5be8cfb5 sha1_{init,process,done}: make static 2012-06-21 17:05:50 +02:00
doko@ubuntu.com 1e3398a50c ... and fix the name of the sha1 file name. 2012-06-21 16:22:15 +02:00
doko@ubuntu.com dca7303ff5 Fix name of the sha1 extension. 2012-06-21 16:00:52 +02:00
doko@ubuntu.com 0684a9d146 Remove references to removed md5.h and md5.c files. 2012-06-21 12:13:35 +02:00
Nadeem Vawda fd8a838d58 Issue #14684: Add support for predefined compression dictionaries to the zlib module.
Original patch by Sam Rushing.
2012-06-21 02:13:12 +02:00
Stefan Krah 50b0a365ba Fix comment. 2012-06-20 23:38:51 +02:00
Stefan Krah 22385011ed Many cleanups of redundant code in mpd_qrem_near():
1) _mpd_qdivmod() uses the context precision only in two places, and
     the new code should be exactly equivalent to the previous code.

  2) Remove misleading comment.

  3) The quotient *is* an integer with exponent 0, so calling mpd_qtrunc()
     is pointless.

  4) Replace two instances of identical code by a single one.

  5) Use _mpd_cmp_abs() instead of mpd_cmp_total_mag(): the operands
     are not special.

  6) Don't clear MPD_Rounded in the status (with the current code it should
     not be set within the function).
2012-06-20 23:34:58 +02:00
Antoine Pitrou e67f48ce5e Issue #14928: Fix importlib bootstrap issues by using a custom executable (Modules/_freeze_importlib) to build Python/importlib.h. 2012-06-19 22:29:35 +02:00
Stefan Krah 9c1feb88f3 Add comments to the power functions, in particular to _mpd_qpow_real(). 2012-06-18 19:57:23 +02:00
Martin v. Löwis bce166681c Issue #14055: Add __sizeof__ support to _elementtree. 2012-06-17 10:41:22 +02:00
Stefan Krah c62bd13cb2 1) State the relative errors of the power functions for integer exponents.
2) _mpd_qpow_mpd(): Abort the loop for all specials, not only infinity.

3) _mpd_qpow_mpd(): Make the function more general and distinguish between
   zero clamping and folding down the exponent. The latter case is currently
   handled by setting context->clamp to 0 before calling the function.

4) _mpd_qpow_int(): Add one to the work precision in case of a negative
   exponent. This is to get the same relative error (0.1 * 10**-prec)
   for both positive and negative exponents. The previous relative
   error for negative exponents was (0.2 * 10**-prec).

   Both errors are _before_ the final rounding to the context precision.
2012-06-16 19:45:35 +02:00
Alexander Belopolsky 0831382d69 Issue #15006: Allow equality comparison between naive and aware time
or datetime objects.
2012-06-15 20:19:47 -04:00
Eli Bendersky 113da64259 Fix windows compilation problems caused by previous commit. 2012-06-15 07:52:49 +03:00
Eli Bendersky 64d11e60f2 Replace the iter/itertext methods of Element in _elementtree with true C implementations, instead of the bootstrapped Python code. In addition to being cleaner (removing the last remains of the bootstrapping code in _elementtree), this gives a 10x performance boost for iter() on large documents.
Also reorganized the tests a bit to be more robust.
2012-06-15 07:42:50 +03:00
Martin v. Löwis bc07cb883e Issue #14936: curses_panel was converted to PEP 3121 and PEP 384 API.
Patch by Robin Schreiber.
2012-06-14 16:01:23 +02:00
Martin v. Löwis c838ec1f82 Issue #14936: curses_panel was converted to PEP 3121 API.
Patch by Robin Schreiber.
2012-06-14 16:00:24 +02:00
Alexander Belopolsky c142bba2a7 Issue #1667546: On platforms supporting tm_zone and tm_gmtoff fields
in struct tm, time.struct_time objects returned by time.gmtime(),
time.localtime() and time.strptime() functions now have tm_zone and
tm_gmtoff attributes.  Original patch by Paul Boddie.
2012-06-13 22:15:26 -04:00
Victor Stinner 2b89fdf7eb PEP 418: Rename adjusted attribute to adjustable in time.get_clock_info() result
Fix also its value on Windows and Linux according to its documentation:
"adjustable" indicates if the clock *can be* adjusted, not if it is or was
adjusted.

In most cases, it is not possible to indicate if a clock is or was adjusted.
2012-06-12 22:46:37 +02:00
Victor Stinner bda4b8802c time.get_clock_info() uses a namespace instead of structseq 2012-06-12 22:11:44 +02:00
Alexander Belopolsky d9738242f8 Fixed a typo in time_localtime() 2012-06-12 16:14:17 -04:00
Stefan Krah b7832939c7 1) Fix signature of _mpd_qpow_uint(): contrary to the comment base is constant.
2) Abort the loop for all specials, not only infinity.

3) Make the function more general and distinguish between zero clamping
   and folding down the exponent. The latter case is currently handled
   by setting context->clamp to 0 before calling the function.
2012-06-12 21:06:06 +02:00
Richard Oudkerk 197651b4e3 Issue #10133: Make multiprocessing deallocate buffer if socket read fails.
Patch by Hallvard B Furuseth.
2012-06-11 15:12:12 +01:00
Stefan Krah 88e19779ad 1) Replace long-winded abort() construct by assert().
2) Remove micro optimization (inline checking for NaN before calling
   mpd_qcheck_nans()) that probably has no benefit in this case.
2012-06-11 08:57:17 +02:00
Stefan Krah 9253862f45 1) State restrictions for the transform length.
2) Switch argument order to match the function signature of mpd_calloc()
   (cosmetic change, since the order is irrelevant).
2012-06-10 16:50:55 +02:00
Stefan Krah afc0c77b42 Add one extra comparison to the _mpd_shortmul() case to avoid repetitive code. 2012-06-09 15:28:36 +02:00
Stefan Krah 5248a2d3c1 Enumerate all cases in the overflow detection strategy in mpd_qlog10(). 2012-06-09 00:01:28 +02:00
Stefan Krah 0bf506cca5 Merge. 2012-06-08 18:55:22 +02:00
Stefan Krah 1cf6dfc8b2 1) List relative error for _mpd_qln10().
2) Add rigorous error analysis to _mpd_qlog10 (ACL2 proofs exist).

3) Use the relative error as a basis for the interval generation in the
   correction loop (same as in _mpd_qln()).
2012-06-08 18:41:33 +02:00
Alexander Belopolsky a4415141da Issue #2736: Added datetime.timestamp() method. 2012-06-08 12:33:09 -04:00
Stefan Krah 7bda265662 1) The overflow detection in mpd_qln() has a surprising number of case splits.
List all of them in the comment.

2) Use the recently stated relative error of _mpd_qln() to generate the
   interval for the exact value of ln(x). See also the comment in mpd_qexp().
2012-06-07 17:48:47 +02:00
Stefan Krah a3394bce33 1) Add error analysis comments to mpd_qln10() and _mpd_qln().
2) Simplify the precision adjustment code for values in [0.900, 1.15].
2012-06-06 15:57:18 +02:00
Gregory P. Smith 902274e948 Fixes issue #15000: support the odd x32 abi on posixsubprocess's system call. 2012-06-05 13:30:24 -07:00
Gregory P. Smith 58f07a9d6d Fixes issue #15000: support the odd x32 abi on posixsubprocess's system call. 2012-06-05 13:26:39 -07:00
Victor Stinner f86a5e8a93 Close #11022: TextIOWrapper doesn't call locale.setlocale() anymore
open() and io.TextIOWrapper are now calling locale.getpreferredencoding(False)
instead of locale.getpreferredencoding() in text mode if the encoding is not
specified. Don't change temporary the locale encoding using locale.setlocale(),
use the current locale encoding instead of the user preferred encoding.

Explain also in open() documentation that locale.getpreferredencoding(False) is
called if the encoding is not specified.
2012-06-05 13:43:22 +02:00
Victor Stinner 034d0aa217 Issue #14711: os.stat_float_times() has been deprecated. 2012-06-05 01:22:15 +02:00
Eli Bendersky c68e1368b5 Fix unterminated keyword array passed to PyArg_ParseTupleAndKeywords 2012-06-03 06:09:42 +03:00
Stefan Krah 67ee1d05dd word.digits are always initialized before use in the Taylor series loop,
but this is more readable.
2012-06-01 10:58:16 +02:00
Eli Bendersky 2b6b73e7e1 Issue #14007: implement doctype() method calling in XMLParser of _elementtree.
Includes exposing a doctype handler from expat through pyexpat.
2012-06-01 11:32:34 +03:00
Eli Bendersky 20d4174b3d We're always building _elementtree with USE_PYEXPAT_CAPI, so the #ifdefs in
the code are unnecessary.
2012-06-01 09:48:37 +03:00
Eli Bendersky 52467b167e Issue #14007: make XMLParser a real subclassable type exported from _elementtree. +cleanups 2012-06-01 07:13:08 +03:00
Stefan Krah 0271766c88 Use workctx instead of ctx for cosmetic reasons. Also zero-pad the result
in the simple path (not correctly rounded but faster).
2012-05-31 20:49:24 +02:00
Stefan Krah 4d3e0a695a Improve Underflow handling in the correct-rounding loop. The case for
Underflow to zero hasn't changed: _mpd_qexp() internally uses MIN_EMIN,
so the result would also underflow to zero for all emin > MIN_EMIN.

In case digits are left, the informal argument is as follows: Underflow can
occur only once in the last multiplication of the power stage (in the Horner
stage Underflow provably cannot occur, and if Underflow occurred twice in
the power stage, the result would underflow to zero on the second occasion).

Since there is no double rounding during Underflow, the effective work
precision is now 1 <= result->digits < prec. It can be shown by a somewhat
tedious argument that abs(result - e**x) < ulp(result, result->digits).

Therefore the correct rounding loop now uses ulp(result, result->digits)
to generate the bounds for e**x in case of Underflow.
2012-05-31 20:01:05 +02:00
Stefan Krah 9a5beece1b Improve comments. 2012-05-31 16:21:34 +02:00
Stefan Krah 5ddbcfc53e Pad the result with zeros just before the final rounding. 2012-05-31 16:00:21 +02:00
Stefan Krah 30c35e8154 Do not clobber existing flags. 2012-05-31 15:09:27 +02:00
Kristjan Valur Jonsson 85634d7a2e Issue #14909: A number of places were using PyMem_Realloc() apis and
PyObject_GC_Resize() with incorrect error handling.  In case of errors,
the original object would be leaked.  This checkin fixes those cases.
2012-05-31 09:37:31 +00:00
Eli Bendersky 48d358ba86 Issue #14007: implemented the 'element_factory' feature of TreeBuilder in
_elementtree, with a test.
2012-05-30 17:57:50 +03:00
Eli Bendersky 58d548dff1 Issue #14007: make TreeBuilder an actual type exposed from _elementtree, and subclassable. 2012-05-29 15:45:16 +03:00
Eli Bendersky 737b173355 Issue 14814: Add namespaces keyword arg to find(*) methods in _elementtree.
Add attrib keyword to Element and SubElement in _elementtree.
Patch developed with Ezio Melotti.
2012-05-29 06:02:56 +03:00
Antoine Pitrou 1cfe7d9a84 Issue #14775: Fix a potential quadratic dict build-up due to the garbage collector repeatedly trying to untrack dicts.
Additional comments by Tim Silk.
2012-05-28 22:23:42 +02:00
Antoine Pitrou e1ad3dac3d Issue #14775: Fix a potential quadratic dict build-up due to the garbage collector repeatedly trying to untrack dicts.
Additional comments by Tim Silk.
2012-05-28 22:22:34 +02:00
Meador Inge d102e04e4a Issue #9041: raised exception is misleading
An issue in ctypes.c_longdouble, ctypes.c_double, and ctypes.c_float that
caused an incorrect exception to be returned in the case of overflow has been
fixed.
2012-05-28 14:47:53 -05:00
Meador Inge 031e25b0f7 Issue #9041: raised exception is misleading
An issue in ctypes.c_longdouble, ctypes.c_double, and ctypes.c_float that
caused an incorrect exception to be returned in the case of overflow has been
fixed.
2012-05-28 14:21:16 -05:00
Richard Oudkerk 26cdf1fe5b Make multiprocessing's shared memory use memoryview instead of raw pointer 2012-05-26 22:09:59 +01:00
Vinay Sajip 7ded1f0f69 Implemented PEP 405 (Python virtual environments). 2012-05-26 03:45:29 +01:00
Benjamin Peterson 9242c1378f capitialize utime statuses 2012-05-25 10:26:47 -07:00
Benjamin Peterson 46c214d893 capitialize enum members 2012-05-25 10:22:29 -07:00
Hynek Schlawack 9866d96e48 #4841: Fix FileIO constructor to honor closefd when called repeatedly
Patch by Victor Stinner.
2012-05-25 10:27:43 +02:00
Hynek Schlawack 2cc7156515 #4841: Fix FileIO constructor to honor closefd when called repeatedly
Patch by Victor Stinner.
2012-05-25 10:05:53 +02:00
Benjamin Peterson 18eac4a1d6 use PyDict_Contains 2012-05-25 00:24:42 -07:00
Benjamin Peterson a6a7a1accf return NULL on error 2012-05-25 00:22:04 -07:00
Benjamin Peterson 2d12e1458f actually return the result 2012-05-25 00:19:40 -07:00
Benjamin Peterson 5ed7bd79df simplify and rewrite the zipimport part of 702009f3c0b1 a bit 2012-05-24 22:54:15 -07:00
Benjamin Peterson 209e04c201 plug ref leak 2012-05-24 22:35:39 -07:00
Eric V. Smith 984b11f88f issue 14660: Implement PEP 420, namespace packages. 2012-05-24 20:21:04 -04:00
Eli Bendersky b20df95827 Issue #14849: setup Element data members to be assignable in subclasses 2012-05-20 06:33:29 +03:00
Stefan Krah 5d953184a6 Issue #14779: Get sizeof(void *) directly rather than relying on sysconfig. 2012-05-16 20:41:56 +02:00
Stefan Krah e34a209584 Fix Visual Studio warning. 2012-05-16 20:20:03 +02:00
Stefan Krah 696d10f1bb Changes in _mpd_qexp():
-----------------------

  1) Reduce the number of iterations in the Horner scheme for operands with
     a negative adjusted exponent. Previously the number was overestimated
     quite generously.

  2) The function _mpd_get_exp_iterations() now has an ACL2 proof and
     is rewritten accordingly.

  3) The proof relies on abs(op) > 9 * 10**(-prec-1), so operands without
     that property are now handled by the new function _mpd_qexp_check_one().

  4) The error analysis for the evaluation of the truncated Taylor series
     in Hull&Abrham's paper relies on the fact that the reduced operand
     'r' has fewer than context.prec digits.

     Since the operands may have more than context.prec digits, a new ACL2
     proof covers the case that r.digits > context.prec. To facilitate the
     proof, the Horner step now uses fma instead of rounding twice in
     multiply/add.


Changes in mpd_qexp():
----------------------

  1) Fix a bound in the correct rounding loop that was too optimistic. In
     practice results were always correctly rounded, because it is unlikely
     that the error in _mpd_qexp() ever reaches the theoretical maximum.
2012-05-16 20:10:21 +02:00
Antoine Pitrou b7d033db78 Issue #14829: Fix bisect and range() indexing with large indices (>= 2 ** 32) under 64-bit Windows.
(untested, because of Windows build issues under 3.x)
2012-05-16 14:39:36 +02:00
Antoine Pitrou a103b96a80 Issue #14829: Fix bisect and range() indexing with large indices (>= 2 ** 32) under 64-bit Windows. 2012-05-16 14:37:54 +02:00
Antoine Pitrou e7672d38dc Issue #14732: The _csv module now uses PEP 3121 module initialization.
Patch by Robin Schreiber.
2012-05-16 11:33:08 +02:00
Martin v. Löwis 33cac8578b Add safecase to silence Win64 warning. 2012-05-15 14:34:58 +02:00
Martin v. Löwis d1b7f3993a Silence VS 2010 warning on loss of precision (_int64 -> _int32).
This is safe because the actual value is already range-checked.
2012-05-15 14:06:21 +02:00
Brian Curtin 401f9f3d32 Fix #13210. Port the Windows build from VS2008 to VS2010. 2012-05-13 11:19:23 -05:00
Ross Lagerwall 4d688e3275 Remove uninitialized compiler warning. 2012-05-12 08:30:33 +02:00
Mark Dickinson 943cab2fec Issue #14741: Merge fix from 3.2. 2012-05-07 17:25:14 +01:00
Mark Dickinson da029fb293 Issue #14741: Fix missing support for ellipsis in parser module. 2012-05-07 17:24:04 +01:00
Mark Dickinson 72f6095d4f Issue #14697: Merge fix from 3.2. 2012-05-07 16:36:33 +01:00
Mark Dickinson 11c1dee183 Issue #14697: Fix missing parser module support for set displays and set comprehensions. 2012-05-07 16:34:34 +01:00