Commit Graph

6727 Commits

Author SHA1 Message Date
Mark Dickinson 9fad160411 Issue #14701: Merge fix from 3.2. 2012-05-07 12:03:11 +01:00
Nadeem Vawda 486a0451f3 Fix buildbot failures in test_lzma. 2012-05-07 00:40:57 +02:00
Nadeem Vawda bc459bb484 Rename lzma.check_is_supported() to is_check_supported() to avoid grammatical confusion. 2012-05-06 23:01:51 +02:00
Nadeem Vawda f55b329edc Add lzma.{encode,decode}_filter_properties(). 2012-05-06 23:01:27 +02:00
Nadeem Vawda 54c74ece28 Fix formatting of preset values for exception messages in _lzmamodule.c. 2012-05-06 13:35:47 +02:00
Benjamin Peterson eaa5eeef57 Backed out changeset 709850f1ec67 2012-05-05 21:22:14 -04:00
Larry Hastings cfe6f2af3c Update Misc/NEWS for issues #14127 and #14705. (And, technically, #10148.) 2012-05-05 17:39:09 -07:00
Larry Hastings faf91e75ab Issue #14705: Add 'p' format character to PyArg_ParseTuple* for bool support. 2012-05-05 16:54:29 -07:00
Stefan Krah 6b03f2ce45 Fix typo in exception message. 2012-05-05 22:37:05 +02:00
Richard Oudkerk 7ef909cdd7 Fix for issue 14725 for 3.2 branch 2012-05-05 20:41:23 +01:00
Richard Oudkerk fdb8dcf675 Fix for Issue 14725 for 3.3 branch. 2012-05-05 19:45:37 +01:00
Benjamin Peterson fbd85a0fbf initialization not needed 2012-05-04 11:06:09 -04:00
Richard Oudkerk f072b45e34 Fix for fatal errors in os.*utime*()
The address of an object was being decreffed instead of the object.
2012-05-04 12:01:31 +01:00
Larry Hastings b333640aba Issue #14127: Fix two bugs with the Windows implementation. 2012-05-04 02:31:57 -07:00
Benjamin Peterson 9bd9d74996 what is a invalid tuple? 2012-05-04 01:42:41 -04:00
Benjamin Peterson b399ab2c5c clean up converted path on error 2012-05-04 01:31:13 -04:00
Benjamin Peterson 3e2e368f3b avoid unitialized memory 2012-05-04 01:14:03 -04:00
Benjamin Peterson 35a8f0dee5 check correct variable for error 2012-05-04 01:10:59 -04:00
Larry Hastings 76ad59b7e8 Issue #14127: Add ns= parameter to utime, futimes, and lutimes.
Removed futimens as it is now redundant.
Changed shutil.copystat to use st_atime_ns and st_mtime_ns from os.stat
and ns= parameter to utime--it once again preserves exact metadata on Linux!
2012-05-03 00:30:07 -07:00
Benjamin Peterson 49a69e4d48 strip is_ prefixes on clock_info fields 2012-05-01 09:38:34 -04:00
Richard Oudkerk 3e268aac3b Mark multiprocessing files with "Licensed to PSF under a Contributor Agreement"
instead of BSD licence.
2012-04-30 12:13:55 +01:00
Mark Dickinson 57404891a0 Issue #14696: Merge from 3.2 2012-04-29 22:20:01 +01:00
Mark Dickinson 407b3bd89b Issue #14696: Fix parser module to understand 'nonlocal' declarations. 2012-04-29 22:18:31 +01:00
Mark Dickinson b63fd2a408 Issue #9154: Merge fix from 3.2. 2012-04-29 18:35:56 +01:00
Mark Dickinson ea7e9f9a83 Issue #9154: Fix parser module to understand function annotations. 2012-04-29 18:34:40 +01:00
Victor Stinner ec89539ccc Issue #14428, #14397: Implement the PEP 418
* Rename time.steady() to time.monotonic()
 * On Windows, time.monotonic() uses GetTickCount/GetTickCount64() instead of
   QueryPerformanceCounter()
 * time.monotonic() uses CLOCK_HIGHRES if available
 * Add time.get_clock_info(), time.perf_counter() and time.process_time()
   functions
2012-04-29 02:41:27 +02:00
Brett Cannon aa93642a35 Issue #14605: Use None in sys.path_importer_cache to represent no
finder instead of using some (now non-existent) implicit finder.
2012-04-27 15:30:58 -04:00
Brett Cannon ce418b448f Issue #14605: Stop having implicit entries for sys.meta_path.
ImportWarning is raised if sys.meta_path is found to be empty.
2012-04-27 14:01:58 -04:00
Victor Stinner 8f825060f1 Check newly created consistency using _PyUnicode_CheckConsistency(str, 1)
* In debug mode, fill the string data with invalid characters
 * Simplify also reference counting in PyCodec_BackslashReplaceErrors()
   and PyCodec_XMLCharRefReplaceError()
2012-04-27 13:55:39 +02:00
Jesus Cea 990eff0776 Backing out 86dc014cdd74. Not ready yet 2012-04-26 17:05:31 +02:00
Jesus Cea 2b47f0a23f Close #10142: Support for SEEK_HOLE/SEEK_DATA 2012-04-26 16:39:35 +02:00
Antoine Pitrou 5438ed1572 Issue #4892: multiprocessing Connections can now be transferred over multiprocessing Connections.
Patch by Richard Oudkerk (sbt).
2012-04-24 22:56:57 +02:00
Jesus Cea 1d642d2af1 Closes Issue #14661: posix module: add O_EXEC, O_SEARCH, O_TTY_INIT (I add some Solaris constants too) 2012-04-24 20:59:17 +02:00
Jesus Cea cf381206fc Issue #14661: posix module: add O_EXEC, O_SEARCH, O_TTY_INIT 2012-04-24 20:44:40 +02:00
Stefan Krah 9d3a5aeabe Defensive programming: mpd_isspecial(r) already implies mpd_isspecial(q), but
this is more readable.
2012-04-20 21:00:31 +02:00
Stefan Krah 3c23a87e58 The divmod function for large numbers now has an ACL2 proof. Related changes:
1) Rename _mpd_qbarrett_divmod into _mpd_base_ndivmod: The function is
     only marginally related to either Barrett's algorithm or to the version
     in Hasselstrom's paper.

  2) In places where the proof assumes exact operations, use new versions of
     add/sub/multiply that set NaN/Invalid_operation if this condition is
     not met. According to the proof this cannot happen, so this should be
     regarded as an extra safety net.

  3) Raise Division_impossible for operands with a number of digits greater
     than MPD_MAX_PREC. This facilitates the audit of the function and can
     practically only occur in the 32-bit version under conditions where
     a MemoryError is already imminent.

  4) Use _mpd_qmul() in places where the result can exceed MPD_MAX_PREC in
     a well defined manner.

  5) Test for mpd_isspecial(qq) in a place where the addition of one
     can theoretically trigger a Malloc_error.

  6) Remove redundant code in _mpd_qdivmod().

  7) Add many comments.
2012-04-20 19:59:20 +02:00
Larry Hastings 6fe20b3aee Issue #14127: Add st_{cma}time_ns fields to os.stat() result object. 2012-04-19 15:07:49 -07:00
Martin v. Löwis aa2efcb0bc Issue #14098: New functions PyErr_GetExcInfo and PyErr_SetExcInfo.
Patch by Stefan Behnel.
2012-04-19 14:33:43 +02:00
Antoine Pitrou 23bba4ca39 Issue #11750: The Windows API functions scattered in the _subprocess and
_multiprocessing.win32 modules now live in a single module "_winapi".
Patch by sbt.
2012-04-18 20:51:15 +02:00
Stefan Krah c51b7fd65b 1) Simplify comment -- one has to read the complete proof (available in ACL2)
in order to understand the algorithm anyway.

2) v->exp == -v->digits may be assumed.

3) Fix comment (v always shares data with a).
2012-04-18 19:27:32 +02:00
Stefan Krah 5d0d2e2b04 Explain the strategy to avoid huge alignment shifts in _mpd_qadd() in detail. 2012-04-18 18:59:56 +02:00
Stefan Krah ed4b21ff4f Cosmetic change: initialize digits to 1 (redundant). 2012-04-18 18:45:22 +02:00
Stefan Krah bc771e9b19 Remove redundant finalization of the result. 2012-04-18 18:25:37 +02:00
Stefan Krah aecaf0b663 Fix comments and whitespace. 2012-04-18 18:08:20 +02:00
Stefan Krah 6369f77d20 Support mythical ones' complement machines. 2012-04-18 17:57:56 +02:00
Stefan Krah 140893cbaa The previous code is correct, but hard to verify: The libmpdec documentation
rightfully states that an mpd_t with a coefficient flagged as MPD_CONST_DATA
must not be in the position of the result operand. In this particular case
several assumptions guarantee that a resize will never occur in all possible
code paths, which was the reason for using MPD_CONST_DATA and saving an
instruction by omitting the initialization of tmp.alloc.

For readability, tmp is now flagged as MPD_STATIC_DATA and tmp.alloc
is initialized.
2012-04-18 17:48:34 +02:00
Antoine Pitrou a3f4457b17 Speed up reading of small files. This avoids multiple C read() calls on pyc files. 2012-04-17 13:50:58 +02:00
Brett Cannon 6f44d66bc4 Issue #13959: Rename imp to _imp and add Lib/imp.py and begin
rewriting functionality in pure Python.

To start, imp.new_module() has been rewritten in pure Python, put into
importlib (privately) and then publicly exposed in imp.
2012-04-15 16:08:47 -04:00
Mark Dickinson da4210f77d Issue #13496: Merge from 3.2 2012-04-15 16:32:04 +01:00
Mark Dickinson a13b109bc0 Issue 13496: Fix bisect.bisect overflow bug for large collections. 2012-04-15 16:30:35 +01:00
Kristján Valur Jónsson 69c635266e Issue #10576: Add a progress callback to gcmodule 2012-04-15 11:41:32 +00:00
Victor Stinner b8d016955a Fix clock_gettime/getres/settime: PyArg_ParseTuple() expects an int
Only use a single #ifdef for the 3 functions.
2012-04-13 23:44:05 +02:00
Stefan Krah ec766a6179 1) Remove claim of an input invariant that is only true for static mpd_t.
Resizing is used _inside_ libmpdec functions, and it is permitted to
   change x->alloc several times while setting x->len at the end of the
   function. Therefore, for dynamic mpd_t x->alloc can _temporarily_ drop
   below x->len. Of course the final result always has x->len <= x->alloc.

   For static mpd_t this cannot happen, since resizing to a smaller
   coefficient is a no-op.

2) Remove micro optimization in mpd_switch_to_dyn(): Previously only the
   valid initialized part of the existing coefficient up to x->len was
   copied to the new dynamic memory area. Now copying does the same as
   realloc() and the entire old memory area is copied.

   The rationale for this change is that it is no longer needed to memorize
   the explanation given in 1).
2012-04-10 23:11:54 +02:00
Stefan Krah 7b544ca08d Fix stale comment. 2012-04-10 23:08:29 +02:00
Stefan Krah cc74b6ab14 Issue #14478: Cache the hash of a Decimal in the C version. 2012-04-10 16:27:58 +02:00
Stefan Krah e37f8b29fc Issue #14520: Add __sizeof__() method to the Decimal object. 2012-04-09 21:27:20 +02:00
Stefan Krah f69aef747a Resize the coefficient to MPD_MINALLOC also if the requested size is below
MPD_MINALLOC. Previously the resize was skipped as a micro optimization.
2012-04-09 20:47:57 +02:00
Stefan Krah dd159ce606 Speed up _decimal by 30-40% for numerical workloads by improving the cache
locality for regularly sized coefficients.
2012-04-09 20:24:57 +02:00
Stefan Krah 94ef3e4c1d Use the MPD() accessor macro. 2012-04-09 19:20:46 +02:00
Kristján Valur Jónsson e638513856 Remove unused variable from gcmodule.c. The code no longer tests for the
presence of a __del__ attribute on objects, rather it uses the tp_del slot.
2012-04-08 13:56:25 +00:00
Brett Cannon 8798ad3e1e struct timeval.tv_usec is 4 bytes on 64-bit OS X as it should be, but
is defined as an int while everyone else expects a long regardless of
length.
2012-04-07 14:59:29 -04:00
Stefan Krah 1bcb138cf2 Merge. 2012-04-07 16:10:04 +02:00
Stefan Krah dc36efa368 1) Fix comment.
2) Assert that the source operand is not special. Prevent resulting assert
   failure (harmless) by initializing flags before calling mpd_qshiftr_inplace.

3) Save a couple of instructions (mpd_zerocoeff already sets digits and len).
   Reorder initialization to match the order in the mpd_t struct.
2012-04-07 15:57:59 +02:00
Kristján Valur Jónsson 10f383a937 Issue #14310: inter-process socket duplication for windows 2012-04-07 11:23:31 +00:00
Ross Lagerwall 0f9eec19ee Don't Py_DECREF NULL variable in io.IncrementalNewlineDecoder.
Found with Clang's Static Analyzer.
2012-04-07 07:09:57 +02:00
Stefan Krah 4771cca817 Whitespace. 2012-04-05 16:15:25 +02:00
Stefan Krah 871b96bd5a Reduce array size. 2012-04-05 16:07:22 +02:00
Stefan Krah a6169484c2 Formatting. 2012-04-05 15:48:59 +02:00
Stefan Krah ff3eca0cc3 Allow printing a leading '-' and the maximum number of exponent digits
rather than raising RuntimeError (allocated space is sufficient for the
additional character).
2012-04-05 15:46:19 +02:00
Stefan Krah 0774e9b9f5 Raise InvalidOperation if exponents of zeros are clamped during exact
conversion in the Decimal constructor. Exact here refers to the
representation and not to the value (clamping does not change the value).
2012-04-05 15:21:58 +02:00
Eli Bendersky 828efdea56 Replace bootstrap imports with real C API calls. 2012-04-05 05:40:58 +03:00
Antoine Pitrou a701388de1 Rename _PyIter_GetBuiltin to _PyObject_GetBuiltin, and do not include it in the stable ABI. 2012-04-05 00:04:20 +02:00
Eli Bendersky 08b852970e Fix Windows compilation errors 2012-04-04 15:55:07 +03:00
Eli Bendersky ebf37a2ffb Fixes and enhancements to _elementtree:
* Fixed refleak problems when GC collection is run (see messages in
  issue #14065)
* Added weakref support to Element objects
2012-04-03 22:02:37 +03:00
Kristján Valur Jónsson 31668b8f7a Issue #14288: Serialization support for builtin iterators. 2012-04-03 10:49:41 +00:00
Victor Stinner 30d79471bb Expose clock_settime() as time.clock_settime() 2012-04-03 00:45:07 +02:00
Victor Stinner 1470f35bc6 Add time.CLOCK_HIGHRES constant, needed on Solaris 2012-04-03 00:31:17 +02:00
Stefan Krah 91c0274bc4 Improve comments. 2012-04-02 20:51:08 +02:00
Benjamin Peterson dba1b40b60 merge 3.2 2012-04-02 11:28:49 -04:00
Benjamin Peterson e900096dc4 prevent writing to stderr from messing up the exception state (closes #14474) 2012-04-02 11:15:17 -04:00
Stefan Krah 5100171d81 Clear the context flags if a context is initialized from the DefaultContext. 2012-04-02 15:02:21 +02:00
Stefan Krah 41e031004b Fix Overflow exception in the bignum factorial benchmark that is due to
the recent change of the default value for context.Emax.
2012-04-01 23:25:34 +02:00
Antoine Pitrou 9a54a260de Issue #14300: Under Windows, sockets created using socket.dup() now allow overlapped I/O.
Patch by sbt.
2012-04-01 01:14:39 +02:00
Antoine Pitrou 6211b88161 Issue #14437: Fix building the _io module under Cygwin. 2012-03-31 23:50:31 +02:00
Andrew Svetlov 9e892bbf28 fix issue #5136: deprecate old unused functions from tkinter.
These functions are not documnted, so no documentation update.
2012-03-31 19:36:39 +03:00
Kristján Valur Jónsson 310052c1f0 Fix warning when compiling socketmodule.c with VS2010
VS2010 defineds the old errno constants in addition to the WSA* ones.
2012-03-31 13:35:00 +00:00
Eli Bendersky 0192ba33b4 Issue #14065: Added cyclic GC support to ET.Element 2012-03-30 16:38:33 +03:00
Stefan Krah 1e25755006 Merge. 2012-03-30 14:19:21 +02:00
Stefan Krah 0e41981cd5 Use abort() rather than exit() to appease tools like rpmlint. abort() is used
in libmpdec to prevent undefined behavior if an invalid context is used. This
cannot occur for the _decimal module since user input for the context is
validated.
2012-03-30 14:12:20 +02:00
R David Murray eac0939ddd #14416: conditionally add LOG_AUTHPRIV facility and LOG_ODELAY to syslog.
Unlike the other facilities, we don't use a fallback for AUTHPRIV if it
doesn't exist.  Because it is intended for logging sensitive log messages, it
is better that a program trying to log such messages fail than that it log
them insecurely.

Initial patch by Federico Reghenzani.
2012-03-29 07:15:45 -04:00
Victor Stinner ad95c2d25c time.time() now uses clock_gettime(CLOCK_REALTIME) if available
clock_gettime(CLOCK_REALTIME) has a better resolution than gettimeofday().
time.time() falls back on gettimeofday() (and then on other functions) on
error.
2012-03-28 02:54:15 +02:00
Victor Stinner 74eb6c0e8b Document the fact that mach_timebase_info() cannot fail
And call mach_absolute_time() after mach_timebase_info().
2012-03-28 02:50:46 +02:00
Stefan Krah 650365b163 Issue #11826: Fix memory leak in atexitmodule. 2012-03-27 11:49:21 +02:00
Victor Stinner 8486076dd5 Fix time.steady(strict=True): don't use CLOCK_REALTIME 2012-03-26 22:53:14 +02:00
Victor Stinner 70b2e1e7d9 Issue #14368: _PyTime_gettimeofday() cannot fail
floattime() must not raise an error if the current time is 1970.1.1 at 00:00.
2012-03-26 22:08:02 +02:00
Stefan Krah 16ecb9dea0 Issue #3367: Merge fix from 3.2. 2012-03-26 15:11:22 +02:00
Stefan Krah 0f6ce8d9df Issue #3367: NULL-terminate argv[] copies to prevent an invalid access
in sys_update_path().
2012-03-26 15:05:22 +02:00
Stefan Krah fe17b2bc77 Raise MemoryError instead of InvalidOperation/MallocError for compatibility
with decimal.py. The standard specifies InsufficientStorage (MallocError) as
a sub-condition of InvalidOperation. This allows a calculation to continue
with NaN results when allocation fails.
2012-03-25 18:59:21 +02:00
Charles-François Natali 55bce63ea0 Issue #14154: Reimplement the bigmem test memory watchdog as a subprocess. 2012-03-24 10:06:23 +01:00
Stefan Krah c64150bcac Fix formatting after removing tabs. 2012-03-23 16:34:41 +01:00
Stefan Krah cd9e1d0205 Whitespace. 2012-03-23 16:22:05 +01:00
Stefan Krah b6405efd1b Use the same exception hierarchy as decimal.py. FloatOperation now also
inherits from TypeError. Cleanup in module initialization to make repeated
import failures robust.
2012-03-23 14:46:48 +01:00
Eli Bendersky 396e8fcf36 Issue #13782: streamline argument type-checking in ET.Element
append, extend and insert now consistently type-check their argument in both
the C and Python implementations, and raise TypeError for non-Element
argument.

Added tests
2012-03-23 14:24:20 +02:00
Antoine Pitrou d0acb411ef Issue #14387: Do not include accu.h from Python.h. 2012-03-22 14:42:18 +01:00
Antoine Pitrou d5d17eb653 Issue #14204: The ssl module now has support for the Next Protocol Negotiation extension, if available in the underlying OpenSSL library.
Patch by Colin Marc.
2012-03-22 00:23:03 +01:00
Stefan Krah 7cc5521d40 Whitespace. 2012-03-21 20:21:20 +01:00
Stefan Krah 1919b7e72b Issue #7652: Integrate the decimal floating point libmpdec library to speed
up the decimal module. Performance gains of the new C implementation are
between 12x and 80x, depending on the application.
2012-03-21 18:25:23 +01:00
Larry Hastings 83a9f48699 Issue #14328: Add keyword-only parameters to PyArg_ParseTupleAndKeywords.
They're optional-only for now (unlike in pure Python) but that's all
I needed.  The syntax can easily be relaxed if we want to support
required keyword-only arguments for extension types in the future.
2012-03-20 20:06:16 +00:00
Ross Lagerwall 71faefc37e Issue #14359: Only use O_CLOEXEC in _posixmodule.c if it is defined.
Based on patch from Hervé Coatanhay.
2012-03-19 06:08:43 +02:00
Ross Lagerwall 5802fdf31f Issue 14359: Only use O_CLOEXEC in _posixmodule.c if it is defined.
Based on patch from Hervé Coatanhay.
2012-03-18 15:55:10 +02:00
Benjamin Peterson e80b29b5b6 cleanup Ellipsis and NotImplemented strings after we're done 2012-03-16 18:45:31 -05:00
Benjamin Peterson 2dbda07a17 fix condition (#14296) 2012-03-16 10:12:55 -05:00
Eli Bendersky 5b77d81314 Issue #14207: the ParseError exception raised by _elementtree was made
consistent to the one raised by the Python module (the 'code' attribute
was added).

In addition, the exception is now documented.

Added a test to check that ParseError has the required attributes, and
threw away the equivalent doctest which is no longer required.
2012-03-16 08:20:05 +02:00
Eli Bendersky f996e775ea Closes Issue #14246: _elementtree parser will now handle io.StringIO 2012-03-16 05:53:30 +02:00
Benjamin Peterson 7b51b8de38 try to fix compilation on glibc's with cpu sets (#14296) 2012-03-14 22:28:25 -05:00
Gregory P. Smith c362cbda97 Fixes Issue 14234: fix for the previous commit, keep compilation when
using --with-system-expat working when the system expat does not have
salted hash support.
2012-03-14 18:11:46 -07:00
Gregory P. Smith 2522771e47 Fixes Issue 14234: fix for the previous commit, keep compilation when
using --with-system-expat working when the system expat does not have
salted hash support.
2012-03-14 18:10:37 -07:00
Victor Stinner 071eca3f5c Issue #10278: Add an optional strict argument to time.steady(), False by default 2012-03-15 01:17:09 +01:00
Victor Stinner ec919cc74d Issue #10278: Drop time.monotonic() function, rename time.wallclock() to time.steady()
* On Mac OS X, time.steady() now uses mach_absolute_time(), a monotonic clock
 * Optimistic change: bet that CLOCK_MONOTONIC and CLOCK_REALTIME are available
   when clock_gettime() is available
 * Rewrite time.steady() documentation
2012-03-15 00:58:32 +01:00
Benjamin Peterson 5e5451940c fix compiler warnings 2012-03-14 18:21:35 -05:00
Gregory P. Smith 70c9c4dca6 Fixes Issue #14234: CVE-2012-0876: Randomize hashes of xml attributes
in the hash table internal to the pyexpat module's copy of the expat
library to avoid a denial of service due to hash collisions.
Patch by David Malcolm with some modifications by the expat project.
2012-03-14 15:00:39 -07:00
Gregory P. Smith 373c740924 Fixes Issue #14234: CVE-2012-0876: Randomize hashes of xml attributes
in the hash table internal to the pyexpat module's copy of the expat
library to avoid a denial of service due to hash collisions.
Patch by David Malcolm with some modifications by the expat project.
2012-03-14 14:41:00 -07:00
Gregory P. Smith 8e91cf6a5e Fixes issue #14234: CVE-2012-0876: Randomize hashes of xml attributes
in the hash table internal to the pyexpat module's copy of the expat
library to avoid a denial of service due to hash collisions.
Patch by David Malcolm with some modifications by the expat project.
2012-03-14 14:26:55 -07:00
Gregory P. Smith db66eba288 Avoid main_window unused compiler warning. 2012-03-13 23:21:53 -07:00
Andrew Svetlov c5ceb0aaaf Revert the patch for issue 3835 because failed on Windows buildbot
Windows build is compiled with no-threaded tcl/tk by default
2012-03-14 09:39:36 -07:00
Victor Stinner b2a3773301 Issue #14180: Fix the select module to handle correctly the Windows timeval
structure. timeval.tv_sec is a long on Windows, not time_t.
2012-03-14 00:20:51 +01:00
Victor Stinner 21f5893571 Issue #14180: datetime.date.fromtimestamp(), datetime.datetime.fromtimestamp()
and datetime.datetime.utcfromtimestamp() now raise an OSError instead of
ValueError if localtime() or gmtime() failed.
2012-03-14 00:15:40 +01:00
Benjamin Peterson 7d74b70e51 merge 3.2 2012-03-13 16:13:35 -05:00
Benjamin Peterson 2354a7593f fix indentation 2012-03-13 16:13:09 -05:00
Martin v. Löwis df50cebbed Issue #3835: Refuse to use unthreaded Tcl in threaded Python.
Patch by Guilherme Polo and Andrew Svetlov.
2012-03-13 13:59:15 -07:00
Victor Stinner d528b01a71 Issue #14180: Fix another typo in kqueue_queue_control() 2012-03-13 16:25:35 +01:00
Victor Stinner d327f9de1f Issue #14180: Fix select.select() compilation on BSD and a typo in kqueue_queue_control() 2012-03-13 15:29:08 +01:00
Victor Stinner 5d272cc6a2 Close #14180: Factorize code to convert a number of seconds to time_t, timeval or timespec
time.ctime(), gmtime(), time.localtime(), datetime.date.fromtimestamp(),
datetime.datetime.fromtimestamp() and datetime.datetime.utcfromtimestamp() now
raises an OverflowError, instead of a ValueError, if the timestamp does not fit
in time_t.

datetime.datetime.fromtimestamp() and datetime.datetime.utcfromtimestamp() now
round microseconds towards zero instead of rounding to nearest with ties going
away from zero.
2012-03-13 13:35:55 +01:00
Sean Reifschneider 7b3c975aaf closes #14259 re.finditer() now takes keyword arguments: pos, endpos.
Contrary to the documentation, finditer() did not take pos and endpos
keyword arguments.
2012-03-12 18:22:38 -06:00
Victor Stinner a8ec5ea923 Issue #14104: Implement time.monotonic() on Mac OS X,
patch written by Nicholas Riley.
2012-03-13 00:25:42 +01:00
Łukasz Langa cad1a07bec minor PEP7-related fix 2012-03-12 23:41:07 +01:00
Łukasz Langa dbd7825d56 #13842: check whether PyUnicode_FromString succeeded 2012-03-12 22:59:11 +01:00
Łukasz Langa f3078fbee2 Fixes #13842: cannot pickle Ellipsis or NotImplemented.
Thanks for James Sanders for the bug report and the patch.
2012-03-12 19:46:12 +01:00
Eli Bendersky 865756a94c Issue #14178: Problem deleting slices with steps != +1 in the _elementtree module.
Fixed the problem and added some tests. Closes #14178
2012-03-09 13:38:15 +02:00
Victor Stinner 8f40860944 Close #14223: curses.addch() is no more limited to the range 0-255 when the
Python curses is not linked to libncursesw. It was a regression introduced in
Python 3.3a1.
2012-03-08 02:08:48 +01:00
Benjamin Peterson 33d21a24fa merge 3.2 (#14212) 2012-03-07 14:59:13 -06:00
Benjamin Peterson e48944b69c keep the buffer object around while we're using it (closes #14212) 2012-03-07 14:50:25 -06:00
Ross Lagerwall 7f4fdb266a Use ANSI C prototype instead of K&R style. 2012-03-07 20:06:33 +02:00
Ross Lagerwall 88748d7bfe Issue #10951: Fix compiler warnings in _sre.c 2012-03-06 21:48:57 +02:00
Ross Lagerwall 8c159761de Issue #10951: Fix warnings in the socket module. 2012-03-06 21:36:18 +02:00
Stefan Krah 2318699f59 Whitespace. 2012-03-06 15:37:36 +01:00
Antoine Pitrou bdb1cf1ca5 Issue #12328: Fix multiprocessing's use of overlapped I/O on Windows.
Also, add a multiprocessing.connection.wait(rlist, timeout=None) function
for polling multiple objects at once.  Patch by sbt.

Complete changelist from sbt's patch:

* Adds a wait(rlist, timeout=None) function for polling multiple
  objects at once.  On Unix this is just a wrapper for
  select(rlist, [], [], timeout=None).

* Removes use of the SentinelReady exception and the sentinels argument
  to certain methods.  concurrent.futures.process has been changed to
  use wait() instead of SentinelReady.

* Fixes bugs concerning PipeConnection.poll() and messages of zero
  length.

* Fixes PipeListener.accept() to call ConnectNamedPipe() with
  overlapped=True.

* Fixes Queue.empty() and SimpleQueue.empty() so that they are
  threadsafe on Windows.

* Now PipeConnection.poll() and wait() will not modify the pipe except
  possibly by consuming a zero length message.  (Previously poll()
  could consume a partial message.)

* All of multiprocesing's pipe related blocking functions/methods are
  now interruptible by SIGINT on Windows.
2012-03-05 19:28:37 +01:00
Stefan Krah 1649c1b33a Issue #14181: Preserve backwards compatibility for getbufferprocs that a) do
not adhere to the new documentation and b) manage to clobber view->obj before
returning failure.
2012-03-05 17:45:17 +01:00
Stefan Krah bf6c7eca43 Issue #14181: Test creating memoryviews from a static exporter with both
view.obj==NULL and view.obj==base.
2012-03-05 14:37:34 +01:00
Florent Xicluna 50eee834fd Issue #14007: drop unused TreeBuilder().xml. 2012-03-05 10:28:42 +01:00
Stefan Krah 4e99a315b7 Issue #14181: Allow memoryview construction from an object that uses the
getbuffer redirection scheme.
2012-03-05 09:30:47 +01:00
Antoine Pitrou 8d3c290de4 Issue #14166: Pickler objects now have an optional `dispatch_table` attribute which allows to set custom per-pickler reduction functions.
Patch by sbt.
2012-03-04 18:31:48 +01:00
Eli Bendersky 092af1fc5c Issue #14128: Exposing Element as an actual type from _elementtree, rather than a factory function.
This makes the C implementation more aligned with the Python implementation.
Also added some tests to ensure that Element is now a type and that it can
be subclassed.
2012-03-04 07:14:03 +02:00
Victor Stinner 643cd68ea4 Issue #13964: signal.sigtimedwait() timeout is now a float instead of a tuple
Add a private API to convert an int or float to a C timespec structure.
2012-03-02 22:54:03 +01:00
Brett Cannon efb00c0cc1 Issue #14153 Create _Py_device_encoding() to prevent _io from having to import
the os module.
2012-02-29 18:31:31 -05:00
Stefan Krah 2201ecbbfc Issue #14125: backport refleak fix (d4adbf908983). 2012-02-27 17:34:17 +01:00
Stefan Krah 4aea7d3811 Issue #14125: Fix refleak in timemodule.c on Windows. Thanks sbt for pointing
out the location of the problem. MS_WINDOWS currently implies !HAVE_WCSFTIME,
so the addition of !defined(HAVE_WCSFTIME) is for readability.
2012-02-27 16:30:26 +01:00
Stefan Krah a03422f5d3 Issue #14125: Fix multiprocessing refleak on Windows. Patch by sbt. 2012-02-27 13:51:02 +01:00
Éric Araujo 408026c7e8 Merge 3.2 2012-02-26 04:07:37 +01:00
Éric Araujo fab976624d Fix typo in “seperat{or,ion}” 2012-02-26 02:14:08 +01:00
Stefan Krah 9a2d99e28a - Issue #10181: New memoryview implementation fixes multiple ownership
and lifetime issues of dynamically allocated Py_buffer members (#9990)
  as well as crashes (#8305, #7433). Many new features have been added
  (See whatsnew/3.3), and the documentation has been updated extensively.
  The ndarray test object from _testbuffer.c implements all aspects of
  PEP-3118, so further development towards the complete implementation
  of the PEP can proceed in a test-driven manner.

  Thanks to Nick Coghlan, Antoine Pitrou and Pauli Virtanen for review
  and many ideas.

- Issue #12834: Fix incorrect results of memoryview.tobytes() for
  non-contiguous arrays.

- Issue #5231: Introduce memoryview.cast() method that allows changing
  format and shape without making a copy of the underlying memory.
2012-02-25 12:24:21 +01:00
Georg Brandl 42ae472798 merge with 3.2 2012-02-21 22:37:36 +01:00
Georg Brandl 7ef825fdab merge with 3.2 2012-02-21 22:36:37 +01:00
Georg Brandl c9a42070a6 Remove reST markup from --help output. Also: O(n**2) is dict construction, not single insertion. 2012-02-21 22:36:27 +01:00
Benjamin Peterson c9f54cf512 enable hash randomization by default 2012-02-21 16:08:05 -05:00
Antoine Pitrou 528b54b263 Fix test failure in test_cmd_line by initializing the hash secret at the earliest point. 2012-02-21 19:08:26 +01:00
Antoine Pitrou 86838b02f0 Fix test failure in test_cmd_line by initializing the hash secret at the earliest point. 2012-02-21 19:03:47 +01:00
Benjamin Peterson e249dcab7a merge 3.2 2012-02-21 11:09:13 -05:00
Benjamin Peterson 69e9727657 ensure no one tries to hash things before the random seed is found 2012-02-21 11:08:50 -05:00
Petri Lehtinen 8b24506534 Merge branch '3.2'
Closes #8033.
2012-02-21 13:59:40 +02:00
Petri Lehtinen 4fe85abab9 sqlite3: Fix 64-bit integer handling in user functions on 32-bit architectures
Closes #8033.
2012-02-21 13:49:50 +02:00
Benjamin Peterson 71f660e00f update to Unicode 6.1 2012-02-20 22:24:29 -05:00
Georg Brandl 2fb477c0f0 Merge 3.2: Issue #13703 plus some related test suite fixes. 2012-02-21 00:33:36 +01:00
Georg Brandl 09a7c72cad Merge from 3.1: Issue #13703: add a way to randomize the hash values of basic types (str, bytes, datetime)
in order to make algorithmic complexity attacks on (e.g.) web apps much more complicated.

The environment variable PYTHONHASHSEED and the new command line flag -R control this
behavior.
2012-02-20 21:31:46 +01:00
Georg Brandl 2daf6ae249 Issue #13703: add a way to randomize the hash values of basic types (str, bytes, datetime)
in order to make algorithmic complexity attacks on (e.g.) web apps much more complicated.

The environment variable PYTHONHASHSEED and the new command line flag -R control this
behavior.
2012-02-20 19:54:16 +01:00
Benjamin Peterson 23d7f12ffb use new generic __dict__ descriptor implementations 2012-02-19 20:02:57 -05:00
Antoine Pitrou c135fa424e Fix last remaining build issues of _ssl under old OpenSSLs. Patch by Vinay. 2012-02-19 21:22:39 +01:00
Antoine Pitrou a9bf2ac726 Try to really fix compilation failures of the _ssl module under very old OpenSSLs. 2012-02-17 18:47:54 +01:00
Antoine Pitrou e9fccb360f Fix compilation when SSL_OP_SINGLE_ECDH_USE isn't defined 2012-02-17 11:53:10 +01:00
Antoine Pitrou 04d4ee4e56 Issue #13014: Fix a possible reference leak in SSLSocket.getpeercert(). 2012-02-15 22:28:21 +01:00
Antoine Pitrou 2f5a163dfc Issue #13014: Fix a possible reference leak in SSLSocket.getpeercert(). 2012-02-15 22:25:27 +01:00
Antoine Pitrou 15af7b4a4f Issue #13015: Fix a possible reference leak in defaultdict.__repr__.
Patch by Suman Saha.
2012-02-15 02:43:47 +01:00
Antoine Pitrou f5f1fe0cb5 Issue #13015: Fix a possible reference leak in defaultdict.__repr__.
Patch by Suman Saha.
2012-02-15 02:42:46 +01:00
Victor Stinner a9c895d497 PyUnicode_DecodeLocale() second argument is now a char*, no more an int 2012-02-14 02:33:38 +01:00
Florent Xicluna a72a98f24a Issue #13988: cElementTree is deprecated and the _elementtree accelerator is automatically used whenever available. 2012-02-13 11:03:30 +01:00
Florent Xicluna f4bdf4e478 Issue #13988: move the python bootstrap code to cElementTree.py, and remove obsolete code for Python 2.4 and 2.5. 2012-02-11 11:28:16 +01:00
Petri Lehtinen bc35bebb45 Undocument and clean up sqlite3.OptimizedUnicode
Closes #13921.
2012-02-09 21:09:03 +02:00
Antoine Pitrou bcf2b59fb5 Issue #13609: Add two functions to query the terminal size:
os.get_terminal_size (low level) and shutil.get_terminal_size (high level).
Patch by Zbigniew Jędrzejewski-Szmek.
2012-02-08 23:28:36 +01:00
Victor Stinner 4195b5caea Backout f8409b3d6449: the PEP 410 is not accepted yet 2012-02-08 23:03:19 +01:00
Victor Stinner ccd5715a14 PEP 410 2012-02-08 14:31:50 +01:00
Charles-François Natali ed4a8fc095 Issue #8184: multiprocessing: On Windows, don't set SO_REUSEADDR on Connection
sockets, and set FILE_FLAG_FIRST_PIPE_INSTANCE on named pipes, to make sure two
listeners can't bind to the same socket/pipe (or any existing socket/pipe).
2012-02-08 21:15:58 +01:00
Victor Stinner 1aa54a417d Issue #13964: Skip os.*utime*() tests if os.stat() doesn't support timestamp
with a subsecond resolution
2012-02-08 04:09:37 +01:00
Victor Stinner a2f7c00638 Issue #13964: Split os.*utime*() subsecond tests into multiple tests to help
debugging
2012-02-08 03:36:25 +01:00
Victor Stinner 8b30201f7d Issue #13846: Add time.monotonic(), monotonic clock. 2012-02-07 23:29:46 +01:00
Petri Lehtinen 4a84f58143 Issue #10811: Fix recursive usage of cursors. Instead of crashing, raise a ProgrammingError now. 2012-02-06 22:04:18 +02:00
Charles-François Natali 7794090251 Following Nick's suggestion, rename posix.fdlistdir() to posix.flistdir(), to
be consistent with other functions accepting file descriptors (fdlistdir() was
added in 3.3, so hasn't been released yet).
2012-02-06 19:54:48 +01:00
Brett Cannon 1d06daa162 Merge 2012-02-03 12:08:32 -05:00
Brett Cannon b6855683cc Check for errors in creating sub-interpreters when testing the C API. 2012-02-03 12:08:03 -05:00
Martin v. Löwis 9d6c66933a Issue #13777: Add PF_SYSTEM sockets on OS X.
Patch by Michael Goderbauer.
2012-02-03 17:44:58 +01:00
Charles-François Natali 3f32fc87ad Merge. 2012-02-02 20:38:10 +01:00