Commit Graph

9631 Commits

Author SHA1 Message Date
Benjamin Peterson c09087680e merge 3.5 2016-06-13 23:43:40 -07:00
Benjamin Peterson 11a693d330 merge 3.4 2016-06-13 23:41:40 -07:00
Benjamin Peterson 06d49bb895 sync ordering of stddef.h includes with expat 2.1.1 2016-06-13 23:41:19 -07:00
doko@ubuntu.com 17f0e61891 - Modules/_collectionsmodule.c: Mark one more internal symbol as static. 2016-06-14 07:27:58 +02:00
Martin Panter 4074f93b33 Issue #16182: Merge readline locale fix from 3.5 2016-06-14 02:47:56 +00:00
Martin Panter f00c49df10 Issue #16182: Fix readline begidx, endidx, and use locale encoding
Based on patch by Serhiy Storchaka.
2016-06-14 01:16:16 +00:00
doko@ubuntu.com fcff437de3 - Comment out socket (SO_REUSEPORT) and posix (O_SHLOCK, O_EXLOCK) constants
exposed on the API which are not implemented on GNU/Hurd. They would not
  work at runtime anyway.
2016-06-13 16:33:04 +02:00
Berker Peksag f84f259b0b Merge from 3.5 2016-06-12 19:18:17 +03:00
Berker Peksag 0e1d6802ff Fix typo in _sqlite/module.h 2016-06-12 19:17:49 +03:00
Berker Peksag 0f355c0022 Issue #27190: Merge from 3.5 2016-06-12 14:10:24 +03:00
Berker Peksag 7bea2347c7 Issue #27190: Raise NotSupportedError if sqlite3 is older than 3.3.1
Patch by Dave Sawyer.
2016-06-12 14:09:51 +03:00
Serhiy Storchaka b62ff6eb57 Issue #25455: Fixed a crash in repr of recursive functools.partial objects. 2016-06-12 11:51:26 +03:00
Serhiy Storchaka 179f960d47 Issue #25455: Fixed a crash in repr of recursive functools.partial objects. 2016-06-12 11:44:06 +03:00
Serhiy Storchaka f0ee5ccd19 Issue #25455: Fixed a crash in repr of ElementTree.Element with recursive tag. 2016-06-12 09:47:20 +03:00
Serhiy Storchaka 9062c261a4 Issue #25455: Fixed a crash in repr of ElementTree.Element with recursive tag. 2016-06-12 09:43:55 +03:00
Benjamin Peterson f0d4621aa2 merge 3.5 (#26556) 2016-06-11 13:33:58 -07:00
Benjamin Peterson b5ad54990f merge 3.4 (#26556) 2016-06-11 13:33:17 -07:00
Benjamin Peterson 196d7db395 upgrade expt to 2.1.1 (closes #26556) 2016-06-11 13:28:56 -07:00
Brett Cannon 96881cd621 Issue #27186: Add os.PathLike support to DirEntry
Initial patch thanks to Jelle Zijlstra.
2016-06-10 14:37:21 -07:00
Serhiy Storchaka f41b82fb19 Issue #26282: PyArg_ParseTupleAndKeywords() and Argument Clinic now support
positional-only and keyword parameters in the same function.
2016-06-09 16:30:29 +03:00
Brett Cannon b4f43e90d9 Clarify documentation for os.fspath(). 2016-06-09 14:32:08 -07:00
Serhiy Storchaka 5dee6551e2 Issue #26305: Argument Clinic now uses braces in C code as required by PEP 7. 2016-06-09 16:16:06 +03:00
Serhiy Storchaka 2561bf6ae0 Issue #26305: Argument Clinic now escapes braces. No need to double them. 2016-06-09 16:03:23 +03:00
Serhiy Storchaka ebe95fdabb Issue #26305: Argument Clinic now escapes braces. No need to double them. 2016-06-09 16:02:15 +03:00
Barry Warsaw efe7256083 Fix a comment. 2016-06-08 17:55:49 -04:00
Barry Warsaw 118598a072 Issue #27066: Fixed SystemError if a custom opener (for open()) returns a
negative number without setting an exception.
2016-06-08 17:54:43 -04:00
Barry Warsaw 480e28538d Issue #27066: Fixed SystemError if a custom opener (for open()) returns
a negative number without setting an exception.
2016-06-08 17:47:26 -04:00
Martin Panter 1ab2f14281 Issue #27164: Merge raw Deflate zdict support from 3.5 2016-06-05 12:07:48 +00:00
Martin Panter 3f0ee83f14 Issue #27164: Allow decompressing raw Deflate streams with predefined zdict
Based on patch by Xiang Zhang.
2016-06-05 10:48:34 +00:00
Ethan Furman d62548afed issue27186: add open/io.open; patch by Jelle Zijlstra 2016-06-04 14:38:43 -07:00
Ethan Furman 410ef8e230 issue27186: add C version of os.fspath(); patch by Jelle Zijlstra 2016-06-04 12:06:26 -07:00
Benjamin Peterson 59ae8ec75f merge 3.5 2016-06-02 12:42:40 -07:00
Benjamin Peterson f585414813 remove (hilarious) defaults for various constants getpath.c needs 2016-06-02 12:41:35 -07:00
Benjamin Peterson 53595c4879 replace custom validation logic in the parse module with a simple DFA validator (closes #26526)
Patch from A. Skrobov.
2016-06-02 11:30:18 -07:00
Martin Panter e2e71685f3 Issue #27171: Fix typo in exception message 2016-06-02 10:13:47 +00:00
Martin Panter 0b7d84de6b Issue #27171: Merge typo fixes from 3.5 2016-06-02 10:11:18 +00:00
Martin Panter e26da7c03a Issue #27171: Fix typos in documentation, comments, and test function names 2016-06-02 10:07:09 +00:00
Martin Panter e514093a2f Issue #27125: Merge typo fixes from 3.5 2016-05-30 05:24:49 +00:00
Martin Panter a90a4a9651 Issue #27125: Remove duplicated words from documentation and comments 2016-05-30 04:04:50 +00:00
Gregory P. Smith ext:(%20%5BGoogle%20Inc.%5D) 46833e73af Fix issue27146 - add stdio.h include to posixmodule.c for ctermid(). 2016-05-28 21:06:41 +00:00
Gregory P. Smith ext:(%20%5BGoogle%20Inc.%5D) fa76eeec70 Fix issue27146 - add stdio.h include to posixmodule.c for ctermid(). 2016-05-28 21:03:48 +00:00
Martin Panter 6bb91f3b6e Issue #20699: Document that “io” methods accept bytes-like objects
This matches the usage of ZipFile and BufferedWriter. This still requires
return values to be bytes() objects.

Also document and test that the write() methods should only access their
argument before they return.
2016-05-28 00:41:57 +00:00
Martin Panter 0fdf41d847 Issue #5784: Expand documentation and tests for zlib wbits parameter
Based on documentation by AM Kuchling.
2016-05-27 07:32:11 +00:00
Martin Panter 46f50726a0 Issue #27076: Doc, comment and tests spelling fixes
Most fixes to Doc/ and Lib/ directories by Ville Skyttä.
2016-05-26 05:35:26 +00:00
Benjamin Peterson 5a093c158a fix indentation and add curlies (closes #27093) 2016-05-23 22:47:50 -07:00
Martin Panter c249221dfd Issue #20699: Merge io bytes-like fixes from 3.5 2016-05-28 01:07:08 +00:00
Martin Panter f4affb71bc Issue #5784: Merge zlib from 3.5 2016-05-27 08:00:24 +00:00
Martin Panter 3e04d5b306 Issue #27076: Merge spelling from 3.5 2016-05-26 06:03:19 +00:00
Benjamin Peterson c35f491a06 merge 3.5 (#27093) 2016-05-23 22:48:05 -07:00
Stefan Krah 1f9eb879d5 Issue #26857: The gethostbyaddr_r() workaround is no longer needed with
api-level >= 23. Patch by Xavier de Gaye.
2016-05-22 17:35:34 +02:00
Serhiy Storchaka 2a95219bc4 Issue #26168: Fixed possible refleaks in failing Py_BuildValue() with the "N"
format unit.
2016-05-20 22:31:50 +03:00
Serhiy Storchaka 13e602ea0f Issue #26168: Fixed possible refleaks in failing Py_BuildValue() with the "N"
format unit.
2016-05-20 22:31:14 +03:00
Victor Stinner da23056a3e Issue #27056: Fix _Unpickler_Read() to avoid integer overflow 2016-05-20 21:16:59 +02:00
Victor Stinner 19ed27ec2b Optimize pickle.load() and pickle.loads()
Issue #27056: Optimize pickle.load() and pickle.loads(), up to 10% faster to
deserialize a lot of small objects.
2016-05-20 11:42:37 +02:00
doko@ubuntu.com bc7315068f - make some internal symbols static 2016-05-18 01:06:01 +02:00
Serhiy Storchaka c944c2dab8 Issue #26995: Added tests for "f", "d", "D", "S", "Y", and "U" format codes
in PyArg_ParseTuple().
2016-05-16 10:12:15 +03:00
Serhiy Storchaka f95455da4c Issue #26995: Added tests for "f", "d", "D", "S", "Y", and "U" format codes
in PyArg_ParseTuple().
2016-05-16 10:11:47 +03:00
Serhiy Storchaka acef5de6ec Backported tests for issue #18531. 2016-05-16 09:55:32 +03:00
Senthil Kumaran 0594cff293 merge from 3.5
issue27018 - Fix the documentation of select.epoll.register method.
2016-05-14 21:29:03 -07:00
Senthil Kumaran 507898d35d issue27018 - Fix the documentation of select.epoll.register method. 2016-05-14 21:28:22 -07:00
Martin Panter f0dbf7a6ab Issue #26870: Add readline.set_auto_history(), originally by Tyler Crompton 2016-05-15 01:26:25 +00:00
Martin Panter 0e40df6e54 Merge ctypes from 3.5 2016-05-14 06:17:30 +00:00
Martin Panter 2dc1bbb659 Remove outdated PEP 291 compatibility requirement comment 2016-05-14 05:55:38 +00:00
Serhiy Storchaka 6a8af9ab36 Issue #25745: Fixed leaking a userptr in curses panel destructor. 2016-05-09 00:14:22 +03:00
Serhiy Storchaka df40b62390 Issue #25745: Fixed leaking a userptr in curses panel destructor. 2016-05-09 00:11:59 +03:00
Serhiy Storchaka ce41287e99 Issue #18531: Single var-keyword argument of dict subtype was passed
unscathed to the C-defined function.  Now it is converted to exact dict.
2016-05-08 23:36:44 +03:00
Serhiy Storchaka dea76376cb Issue #23815: Fixed crashes related to directly created instances of types in
_tkinter and curses.panel modules.
2016-05-08 20:46:55 +03:00
Serhiy Storchaka e3f1b0911e Issue #23815: Fixed crashes related to directly created instances of types in
_tkinter and curses.panel modules.
2016-05-08 20:46:22 +03:00
Martin Panter 1ce738e08f Merge typo fixes from 3.5 2016-05-08 14:02:35 +00:00
Martin Panter 4c35964b76 Corrections for a/an in code comments and documentation 2016-05-08 13:53:41 +00:00
Martin Panter 129fe04d4d Issue #26512: Clarify Integral; tidy up table of rounding functions
Based on patch by Julien.
2016-05-08 12:22:37 +00:00
Martin Panter 18933ed6ab Issue #26512: Merge rounding doc from 3.5 2016-05-08 12:34:58 +00:00
Berker Peksag 1a269d09f6 Issue #26924: Fix Windows buildbots
sem_unlink is defined as

    #define SEM_UNLINK(name) 0

under Windows.
2016-05-07 21:13:50 +03:00
Berker Peksag 0ce9cd985b Issue #26924: Do not define _multiprocessing.sem_unlink under Android
Android declares sem_unlink but doesn't implement it.
2016-05-07 20:39:20 +03:00
Serhiy Storchaka deab18dfd0 Issue #26708: Use the "const" qualifier for immutable strings.
This can help to avoid unintentional modification.
2016-05-07 16:45:18 +03:00
Serhiy Storchaka c2f7d87897 Issue #26932: Fixed support of RTLD_* constants defined as enum values,
not via macros (in particular on Android).  Patch by Chi Hsuan Yen.
2016-05-04 09:44:44 +03:00
Serhiy Storchaka 7a9579c0ce Got rid of redundand "self" parameter declarations.
Argument Clinic is now able to infer all needed information.
2016-05-02 13:45:20 +03:00
Berker Peksag 312f208568 Issue #18916: Update thread module docstrings
* Fix acquire() signature
* Remove outdated help(LockType) reference
* Replace PyThread_allocate_lock() with threading.Lock()

Patch by Christopher Welborn.
2016-05-02 12:26:00 +03:00
Berker Peksag 720e65541c Issue #18916: Update thread module docstrings
* Fix acquire() signature
* Remove outdated help(LockType) reference
* Replace PyThread_allocate_lock() with threading.Lock()

Patch by Christopher Welborn.
2016-05-02 12:25:35 +03:00
Berker Peksag a2570626c8 Issue #26898: Fix typo in math.isclose() docstring
Patch by Marco Buttu.
2016-05-01 11:27:59 +03:00
Berker Peksag d6e6f8b829 Issue #26898: Fix typo in math.isclose() docstring
Patch by Marco Buttu.
2016-05-01 11:27:37 +03:00
Berker Peksag 0ac70c0e90 Fix typos. Reported by andportnoy on GitHub. 2016-04-29 16:54:10 +03:00
Serhiy Storchaka 54b60cf628 Issue #26822: Decreased an overhead of using _PyArg_NoKeywords() in calls of
itemgetter, attrgetter and methodcaller objects.
2016-04-29 09:12:25 +03:00
Serhiy Storchaka 6dfcde5e29 Issue #26822: Decreased an overhead of using _PyArg_NoKeywords() in calls of
itemgetter, attrgetter and methodcaller objects.
2016-04-29 09:10:55 +03:00
Stefan Krah fb7c8ae4e7 Issue #26863: HAVE_FACCESSAT should (currently) not be defined on Android. 2016-04-26 17:04:18 +02:00
Stefan Krah fa935c4727 Issue #26854: Android has a different include path for soundcard.h. 2016-04-26 16:48:48 +02:00
Stefan Krah 8d013a8d36 Issue #26846: Post commit cleanup. 2016-04-26 16:34:41 +02:00
Stefan Krah 432dfcf3bc Issue #26857: Workaround for missing symbol "gethostbyaddr_r" on Android. 2016-04-26 16:20:17 +02:00
Stefan Krah 45009778aa Issue #20306: Android is the only system that returns NULL for the pw_passwd
field.  Rather than cluttering the tests, translate the arguably more correct
"None" to an empty string.
2016-04-26 11:43:21 +02:00
Stefan Krah 267b639a26 Issue #20306: The pw_gecos and pw_passwd fields are not required by POSIX.
If they aren't present, set them to an empty string.
2016-04-26 01:09:18 +02:00
Stefan Krah 8e1da5823b Issue #26846: Workaround for non-standard stdlib.h on Android. 2016-04-25 22:48:42 +02:00
Serhiy Storchaka 745145a7da Issue #26822: itemgetter, attrgetter and methodcaller objects no longer
silently ignore keyword arguments.
2016-04-23 10:53:43 +03:00
Serhiy Storchaka c2a2a751cf Issue #26822: itemgetter, attrgetter and methodcaller objects no longer
silently ignore keyword arguments.
2016-04-23 10:51:39 +03:00
Martin Panter abe4d52a1a Merge doc and comment fixes from 3.5 2016-04-19 23:23:16 +00:00
Martin Panter 8f26565ba9 Fix spelling (inital), grammar (may translates) in documentation, comments 2016-04-19 04:03:41 +00:00
Serhiy Storchaka b6a9c9761c Issue #26778: Fixed "a/an/and" typos in code comment, documentation and error
messages.
2016-04-17 09:39:28 +03:00
Serhiy Storchaka 6a7b3a77b4 Issue #26778: Fixed "a/an/and" typos in code comment and documentation. 2016-04-17 08:32:47 +03:00
Martin Panter 8b04a945ef Merge typo fixes from 3.5 2016-04-16 09:29:17 +00:00
Martin Panter 119e502277 Fix typos in code comments and documentation 2016-04-16 09:28:57 +00:00
Gregory P. Smith b0c6380640 merge heads 2016-04-15 16:47:32 -07:00
Martin Panter b030991a5f Issue #26535: Correct docs regarding the struct buffer size 2016-04-15 23:03:54 +00:00
Martin Panter cda80940ed Issue #15984: Merge PyUnicode doc from 3.5 2016-04-15 02:27:11 +00:00
Martin Panter 6245cb3c01 Correct “an” → “a” with “Unicode”, “user”, “UTF”, etc
This affects documentation, code comments, and a debugging messages.
2016-04-15 02:14:19 +00:00
Berker Peksag 2c164b738d Fix unused variable 'libver' warning in Modules/_ssl.c
It can be seen on various buildbots like 3.x.cea-indiana-amd64
and 3.x.murray-snowleopard:

/export/home/buildbot/64bits/3.x.cea-indiana-amd64/build/Modules/_ssl.c:2227: warning: unused variable 'libver'

/Users/buildbot/buildarea/3.x.murray-snowleopard/build/Modules/_ssl.c:2227: warning: unused variable ‘libver’
2016-04-14 16:49:21 +03:00
Berker Peksag dfcb041195 Fix unused variable 'libver' warning in Modules/_ssl.c
It can be seen on various buildbots like 3.x.cea-indiana-amd64
and 3.x.murray-snowleopard:

/export/home/buildbot/64bits/3.x.cea-indiana-amd64/build/Modules/_ssl.c:2227: warning: unused variable 'libver'

/Users/buildbot/buildarea/3.x.murray-snowleopard/build/Modules/_ssl.c:2227: warning: unused variable ‘libver’
2016-04-14 16:48:48 +03:00
Serhiy Storchaka 2eb6b0d1bd Issues #26716, #26057: Regenerate Argument Clinic code. 2016-04-14 12:30:54 +03:00
Serhiy Storchaka d6117a4296 Issue #26716: Regenerate Argument Clinic code. 2016-04-14 12:28:01 +03:00
Serhiy Storchaka 21a663ea28 Issue #26057: Got rid of nonneeded use of PyUnicode_FromObject(). 2016-04-13 15:37:23 +03:00
Serhiy Storchaka 59865e7fe1 Issue #26200: Restored more safe usages of Py_SETREF. 2016-04-11 09:57:37 +03:00
Serhiy Storchaka 864b63c33f Issue #26200: Restored more safe usages of Py_SETREF. 2016-04-11 09:53:37 +03:00
Martin Panter 50ab1a3694 Issue #26685: Raise OSError if closing a socket fails 2016-04-11 00:38:12 +00:00
Serhiy Storchaka f01e408c16 Issue #26200: Added Py_SETREF and replaced Py_XSETREF with Py_SETREF
in places where Py_DECREF was used.
2016-04-10 18:12:01 +03:00
Serhiy Storchaka 57a01d3a0e Issue #26200: Added Py_SETREF and replaced Py_XSETREF with Py_SETREF
in places where Py_DECREF was used.
2016-04-10 18:05:40 +03:00
Serhiy Storchaka 96cdbe7bc8 Issue #26719: More efficient formatting of ints and floats in json. 2016-04-10 14:43:04 +03:00
Serhiy Storchaka e0805cf10e Issue #26719: More efficient formatting of ints and floats in json. 2016-04-10 14:41:19 +03:00
Victor Stinner 1edcd50b5d Merge 3.5: fcntl doc 2016-04-09 11:33:53 +02:00
Victor Stinner d0d5154251 Update fcntl doc: replace IOError with OSError
Issue #26716. IOError is a deprecated alias to OSError since Python 3.3.
2016-04-09 11:32:58 +02:00
Berker Peksag fe21de9836 Issue #26687: Use Py_RETURN_NONE macro in sqlite3 module 2016-04-09 07:34:39 +03:00
Serhiy Storchaka 3291d85a2f Issue #26671: Fixed #ifdef indentation. 2016-04-06 23:02:46 +03:00
Serhiy Storchaka aaf553bac4 Backed out changeset 8dc144e47252 2016-04-06 23:02:25 +03:00
Serhiy Storchaka 026110f0a2 Issue #26671: Fixed #ifdef indentation. 2016-04-06 22:55:31 +03:00
Serhiy Storchaka 819399b2ab Issue #26671: Enhanced path_converter.
Exceptions raised during converting argument of correct type are no longer
overridded with TypeError. Some error messages are now more detailed.
2016-04-06 22:17:52 +03:00
Serhiy Storchaka ec39756960 Issue #22570: Renamed Py_SETREF to Py_XSETREF. 2016-04-06 09:50:03 +03:00
Serhiy Storchaka 48842714b9 Issue #22570: Renamed Py_SETREF to Py_XSETREF. 2016-04-06 09:45:48 +03:00
Martin Panter b15c304984 Issue #6953: Merge readline doc from 3.5 2016-04-05 10:17:38 +00:00
Martin Panter 0f7673943a Issue #6953: Rearrange and expand Readline module documentation
* Group functions into six new subsections
* Document the underlying Readline function or variable accessed
* get_history_length() returns the history file limit
* clear_history() is conditionally compiled in
* Clarify zero and one bases for history item indexes
* parse_and_bind() uses its argument directly as an init line
* Change "command line" to "line buffer" for consistency
* read_init_file() also executes the file
* read_history_file() replaces the previous history
* write_history_file() overwrites any existing file
* Differentiate history file lines from history list items, which could be
  multi-line
* Add more information about completion, also addressing Issue #10796
* libedit (Editline) may be used on any platform; detection is OS X specific
2016-04-05 07:37:22 +00:00
Martin Panter 9ad764601b Issue #23735: Merge sighandler_t fix from 3.5 2016-04-03 08:04:35 +00:00
Martin Panter 28f35b24b6 Issue #23735: Avoid sighandler_t Gnu-ism 2016-04-03 08:00:49 +00:00
Martin Panter a3506005b3 Issue #23735: Merge Readline resize handling from 3.5 2016-04-03 03:19:27 +00:00
Martin Panter 5dbbf1abba Issue #23735: Add SIGWINCH handler for Readline 6.3+ support, by Eric Price 2016-04-03 02:54:58 +00:00
Victor Stinner 89d3f53aac Merge 3.5 (asyncio) 2016-04-01 21:40:14 +02:00
Victor Stinner ccdbe80a56 asyncio: sync overlapped.c with GitHub
On Python 3.3, use aliases:

* PyMem_RawMalloc = PyMem_Malloc
* PyMem_RawFree = PyMem_Free

These aliases are not need in Python 3.5, but this change makes synchronization
of code base simpler.
2016-04-01 21:37:41 +02:00
Martin Panter 047f3b7376 Issue #22854: Merge UnsupportedOperation fixes from 3.5 2016-03-31 08:25:59 +00:00
Martin Panter 754aab28ed Issue #22854: Clarify documentation about UnsupportedOperation and add tests
Also change BufferedReader.writable() and BufferedWriter.readable() to always
return False.
2016-03-31 07:21:56 +00:00
Serhiy Storchaka ab0d198c7a Issue #26492: Exhausted iterator of array.array now conforms with the behavior
of iterators of other mutable sequences: it lefts exhausted even if iterated
array is extended.
2016-03-30 21:11:16 +03:00
Serhiy Storchaka ab479c49d3 Issue #26494: Fixed crash on iterating exhausting iterators.
Affected classes are generic sequence iterators, iterators of str, bytes,
bytearray, list, tuple, set, frozenset, dict, OrderedDict, corresponding
views and os.scandir() iterator.
2016-03-30 20:41:15 +03:00
Serhiy Storchaka fbb1c5ee06 Issue #26494: Fixed crash on iterating exhausting iterators.
Affected classes are generic sequence iterators, iterators of str, bytes,
bytearray, list, tuple, set, frozenset, dict, OrderedDict, corresponding
views and os.scandir() iterator.
2016-03-30 20:40:02 +03:00
Martin Panter afd465d497 Issue #26644: Merge SSL negative read fix from 3.5 2016-03-27 10:40:22 +00:00
Martin Panter 5503d4731e Issue #26644: Raise ValueError for negative SSLSocket.recv() and read() 2016-03-27 05:35:19 +00:00
Alexander Belopolsky 16b698b095 merge 2016-03-25 15:46:55 -04:00
Alexander Belopolsky 1dcf4f9ee5 Issue#26616:Fixed a bug in datetime.astimezone() method. 2016-03-25 15:42:59 -04:00
Victor Stinner 5e14a38e8e _tracemalloc: use compact key for traces
Issue #26588: Optimize memory footprint of _tracemalloc before non-zero domain
is used. Start with compact key (Py_uintptr_t) and also switch to pointer_t key
when the first memory block with a non-zero domain is tracked.
2016-03-23 22:03:55 +01:00
Victor Stinner cc73932125 socketmodule.c: error if option larger than INT_MAX
On Windows, socket.setsockopt() raises an OverflowError if the socket option is
larger than INT_MAX bytes.
2016-03-23 21:35:29 +01:00
Stefan Krah 66e9d03bf4 Issue #26621: Update libmpdec version and remove unnecessary test case. 2016-03-23 20:50:10 +01:00
Victor Stinner 82d44f0598 Issue #23848: Fix usage of _Py_DumpDecimal() 2016-03-23 18:37:54 +01:00
Victor Stinner 928ad285b5 Issue #23848: Try to fix test_faulthandler on ARM
Restore the previous code for stack_overflow().
2016-03-23 15:19:12 +01:00
Victor Stinner 412a5e7e23 faulthandler: only log fatal exceptions
Issue #23848, #26622:

* faulthandler now only logs fatal Windows exceptions.
* write error code as decimal, not as hexadecimal
* replace "Windows exception" with "Windows fatal exception"
2016-03-23 14:44:14 +01:00
Victor Stinner 404cdc5a92 faulthandler: add Windows exception handler
Issue #23848: On Windows, faulthandler.enable() now also installs an exception
handler to dump the traceback of all Python threads on any Windows exception,
not only on UNIX signals (SIGSEGV, SIGFPE, SIGABRT).
2016-03-23 10:39:17 +01:00
Victor Stinner 5dacbd4c42 Cleanup hashtable.h
Issue #26588:

* Pass the hash table rather than the key size to hash and compare functions
* _Py_HASHTABLE_READ_KEY() and _Py_HASHTABLE_ENTRY_READ_KEY() macros now expect
  the hash table as the first parameter, rather than the key size
* tracemalloc_get_traces_fill(): use _Py_HASHTABLE_ENTRY_READ_DATA() rather
  than pointer dereference
* Remove the _Py_HASHTABLE_ENTRY_WRITE_PKEY() macro
* Move "PKEY" and "PDATA" macros inside hashtable.c
2016-03-23 09:52:13 +01:00
Victor Stinner ca79ccd9e6 Issue #26588:
* Optimize tracemalloc_add_trace(): modify hashtable entry data (trace) if the
  memory block is already tracked, rather than trying to remove the old trace
  and then add a new trace.
* Add _Py_HASHTABLE_ENTRY_WRITE_DATA() macro
2016-03-23 09:38:54 +01:00
Victor Stinner e8c6b2fd1b Issue #26588:
* _Py_HASHTABLE_ENTRY_DATA: change type from "char *" to "const void *"
* Add _Py_HASHTABLE_ENTRY_WRITE_PKEY() macro
* Rename _Py_HASHTABLE_ENTRY_WRITE_DATA() macro to
  _Py_HASHTABLE_ENTRY_WRITE_PDATA()
* Add _Py_HASHTABLE_ENTRY_WRITE_DATA() macro
2016-03-23 09:25:01 +01:00
Victor Stinner 42bcf37fcf Issue #26588: Optimize tracemalloc_realloc()
No need to remove the old trace if the memory block didn't move.
2016-03-23 09:08:08 +01:00
Victor Stinner 7bfa409ff8 Implement finalizer for os.scandir() iterator
Issue #26603:

* Implement finalizer for os.scandir() iterator
* Set the source parameter when emitting the ResourceWarning warning
* Close the iterator before emitting the warning
2016-03-23 00:43:54 +01:00
Victor Stinner 060f9bb602 Fix macros in hashtable.h
Add parenthesis.
2016-03-23 00:18:36 +01:00
Victor Stinner 35b0fd74dd Merge 3.5 2016-03-23 00:17:54 +01:00
Victor Stinner d5871e62dd Enhance _tracemalloc debug mode
Issue #26588: Enhance assertion in set_reentrant()
2016-03-23 00:17:04 +01:00
Victor Stinner 2f49e09110 Fix _tracemalloc start/stop
Issue #26588: Fix _tracemalloc start/stop: don't play with the reentrant flag.

set_reentrant(1) fails with an assertion error if tracemalloc_init() is called
first in a thread A and tracemalloc_start() is called second in a thread B. The
tracemalloc is imported in a thread A. Importing the module calls
tracemalloc_init(). tracemalloc.start() is called in a thread B.
2016-03-23 00:10:24 +01:00
Victor Stinner f9a71153e9 Issue #26588: remove debug traces from _tracemalloc. 2016-03-22 23:54:42 +01:00
Victor Stinner eddb074c53 Issue #26588: more debug traces 2016-03-22 21:06:07 +01:00
Victor Stinner b8d927266d Issue #26588: Don't call tracemalloc_init() at module initilization
So it's possible to get debug messages in test_tracemalloc.
2016-03-22 20:56:49 +01:00
Victor Stinner e31e35d34e Issue #26588: one more assertion 2016-03-22 18:48:50 +01:00
Victor Stinner 4a06647534 Add assertions on tracemalloc_reentrant_key
Issue #26588.
2016-03-22 17:45:09 +01:00
Victor Stinner 0cfc058d61 Issue #26588: more assertions 2016-03-22 17:40:07 +01:00
Victor Stinner 84aab09421 Issue #26588: add debug traces
Try to debug random failure on buildbots.
2016-03-22 16:13:31 +01:00
Victor Stinner 10b73e1748 Add C functions _PyTraceMalloc_Track()
Issue #26530:

* Add C functions _PyTraceMalloc_Track() and _PyTraceMalloc_Untrack() to track
  memory blocks using the tracemalloc module.
* Add _PyTraceMalloc_GetTraceback() to get the traceback of an object.
2016-03-22 13:39:05 +01:00
Victor Stinner e492ae50e2 tracemalloc now supports domains
Issue #26588:

* The _tracemalloc now supports tracing memory allocations of multiple address
  spaces (domains).
* Add domain parameter to tracemalloc_add_trace() and
  tracemalloc_remove_trace().
* tracemalloc_add_trace() now starts by removing the previous trace, if any.
* _tracemalloc._get_traces() now returns a list of (domain, size,
  traceback_frames): the domain is new.
* Add tracemalloc.DomainFilter
* tracemalloc.Filter: add an optional domain parameter to the constructor and a
  domain attribute
* Sublte change: use Py_uintptr_t rather than void* in the traces key.
* Add tracemalloc_config.use_domain, currently hardcoded to 1
2016-03-22 12:58:23 +01:00
Victor Stinner 58100059ac Remove _Py_hashtable_delete()
Issue #26588: Remove _Py_hashtable_delete() from hashtable.h since the function
is not used. Keep the C code in hashtable.c as commented code if someone needs
it later.
2016-03-22 12:25:04 +01:00
Victor Stinner c9553876ae Simplify implementation of hashtable.c
Issue #26588: Remove copy_data, free_data and get_data_size callbacks from
hashtable.h. These callbacks are not used in Python and makes the code more
complex.

Remove also the _Py_HASHTABLE_ENTRY_DATA_AS_VOID_P() macro which uses an unsafe
pointer dereference (can cause memory alignment issue). Replace the macro usage
with _Py_HASHTABLE_ENTRY_READ_DATA() which is implemented with the safe
memcpy() function.
2016-03-22 12:13:01 +01:00
Martin Panter 0b2d71bc70 Issue #24266: Merge readline Ctrl+C handling from 3.5 2016-03-22 09:28:58 +00:00
Martin Panter d6990d221b Issue #24266: Cancel history search mode with Ctrl+C in Readline 7 2016-03-22 07:24:05 +00:00
Martin Panter 12eb2ab490 Issue #15699: Merge readline fixup from 3.5 2016-03-22 02:26:18 +00:00
Martin Panter f6e9f47aa7 Issue #15699: Reunite comment with variable 2016-03-22 02:19:29 +00:00
Victor Stinner b32a7edb22 Issue #26588: Fix compilation warning on Windows 2016-03-21 23:05:08 +01:00
Victor Stinner 285cf0a601 hashtable.h now supports keys of any size
Issue #26588: hashtable.h now supports keys of any size, not only
sizeof(void*). It allows to support key larger than sizeof(void*), but also to
use less memory for key smaller than sizeof(void*).
2016-03-21 22:00:58 +01:00
Victor Stinner 928bff0b26 cleanup iobase.c
casting iobase_finalize to destructor is not needed
2016-03-19 10:36:36 +01:00
Victor Stinner 19a8e844e4 Add socket finalizer
Issue #26590: Implement a safe finalizer for the _socket.socket type. It now
releases the GIL to close the socket. Use PyErr_ResourceWarning() to raise the
ResourceWarning to pass the socket object to the warning logger, to get the
traceback where the socket was created (allocated).
2016-03-21 16:36:48 +01:00
Victor Stinner 322bc12c31 Ooops, revert changeset ea9efa06c137
Change pushed by mistake, the patch is still under review :-/

"""
_tracemalloc: add domain to trace keys

* hashtable.h: key has now a variable size
* _tracemalloc uses (pointer: void*, domain: unsigned int) as key for traces
"""
2016-03-21 14:36:39 +01:00
Victor Stinner 51b846c47a _tracemalloc: add domain to trace keys
* hashtable.h: key has now a variable size
* _tracemalloc uses (pointer: void*, domain: unsigned int) as key for traces
2016-03-18 21:52:22 +01:00
Berker Peksag 3c3d7f4b99 Issue #18787: spwd.getspnam() now raises a PermissionError if the user
doesn't have privileges.
2016-03-19 11:44:17 +02:00
Victor Stinner f664dc5834 ResourceWarning: Revert change on socket and scandir
io.FileIO has a safe implementation of destructor, but not socket nor scandir.
2016-03-19 02:01:48 +01:00
Victor Stinner 914cde89d4 On ResourceWarning, log traceback where the object was allocated
Issue #26567:

* Add a new function PyErr_ResourceWarning() function to pass the destroyed
  object
* Add a source attribute to warnings.WarningMessage
* Add warnings._showwarnmsg() which uses tracemalloc to get the traceback where
  source object was allocated.
2016-03-19 01:03:51 +01:00
Victor Stinner 13be7db34c Fix usage of PyMem_Malloc() in overlapped.c
Issue #26563: Replace PyMem_Malloc() with PyMem_RawFree() since
PostToQueueCallback() calls PyMem_RawFree() (previously PyMem_Free()) in a new
C thread which doesn't hold the GIL.
2016-03-16 23:25:02 +01:00
Victor Stinner 6150f31963 Fix usage of PyMem_Malloc() in overlapped.c
Issue #26563: Replace PyMem_Malloc() with PyMem_RawFree() since
PostToQueueCallback() calls PyMem_RawFree() (previously PyMem_Free()) in a new
C thread which doesn't hold the GIL.
2016-03-16 23:25:02 +01:00
Victor Stinner 861d9abfcf faulthandler now works in non-Python threads
Issue #26563:

* Add _PyGILState_GetInterpreterStateUnsafe() function: the single
  PyInterpreterState used by this process' GILState implementation.
* Enhance _Py_DumpTracebackThreads() to retrieve the interpreter state from
  autoInterpreterState in last resort. The function now accepts NULL for interp
  and current_tstate parameters.
* test_faulthandler: fix a ResourceWarning when test is interrupted by CTRL+c
2016-03-16 22:45:24 +01:00
Victor Stinner c36674a2c5 Fix usage of PyMem_Malloc() in os.stat()
Issue #26563: Replace PyMem_Malloc() with PyMem_RawMalloc() in the Windows
implementation of os.stat(), since the code is called without holding the GIL.
2016-03-16 14:30:16 +01:00
Victor Stinner ad524375af Fail if PyMem_Malloc() is called without holding the GIL
Issue #26563: Debug hooks on Python memory allocators now raise a fatal error
if functions of the PyMem_Malloc() family are called without holding the GIL.
2016-03-16 12:12:53 +01:00
Victor Stinner 0611c26a58 On memory error, dump the memory block traceback
Issue #26564: _PyObject_DebugDumpAddress() now dumps the traceback where a
memory block was allocated on memory block. Use the tracemalloc module to get
the traceback.
2016-03-15 22:22:13 +01:00
Victor Stinner af584a02a5 Merge 3.5 (_tracemalloc) 2016-03-15 21:57:23 +01:00
Victor Stinner 9528334e16 _tracemalloc: store lineno as unsigned int
Issue #26564. Cleanup the code, lineno is never negative.
2016-03-15 21:57:02 +01:00
Victor Stinner b380010782 Merge 3.5 (test_faulthandler) 2016-03-15 17:24:13 +01:00
Victor Stinner 57003f81ea faulthandler: Test Py_FatalError() with GIL released
Issue #26558.
2016-03-15 17:23:35 +01:00
Victor Stinner 7105e9f3de _tracemalloc: filename cannot be NULL 2016-03-15 14:28:04 +01:00
Victor Stinner c4aec3628b Check the GIL in PyObject_Malloc()
Issue #26558: The debug hook of PyObject_Malloc() now checks that the GIL is
held when the function is called.
2016-03-14 22:26:53 +01:00
Victor Stinner 13f0c6166f _pickle: Fix load_counted_tuple(), use Py_ssize_t for size
Fix a warning on Windows 64-bit.
2016-03-14 18:09:39 +01:00
Victor Stinner 21b47117ac _pickle: Fix load_counted_tuple(), use Py_ssize_t for size
Fix a warning on Windows 64-bit.
2016-03-14 18:09:39 +01:00
Victor Stinner c44f70770b posix_getcwd(): limit to INT_MAX on Windows
It's more to fix a conversion warning during compilation, I don't think that
Windows support current working directory larger than 2 GB ...
2016-03-14 18:07:53 +01:00
Victor Stinner d222653f8f Issue #26558: Remove useless check in tracemalloc
The first instruction of tracemalloc_add_trace() is traceback_new() which
already checks the GIL.
2016-03-14 17:01:32 +01:00
Victor Stinner 34be807ca4 Add PYTHONMALLOC env var
Issue #26516:

* Add PYTHONMALLOC environment variable to set the Python memory
  allocators and/or install debug hooks.
* PyMem_SetupDebugHooks() can now also be used on Python compiled in release
  mode.
* The PYTHONMALLOCSTATS environment variable can now also be used on Python
  compiled in release mode. It now has no effect if set to an empty string.
* In debug mode, debug hooks are now also installed on Python memory allocators
  when Python is configured without pymalloc.
2016-03-14 12:04:26 +01:00
Ned Deily 8cd8883d27 Issue #26505: merge from 3.5 2016-03-07 14:52:46 -05:00
Ned Deily adbf8cecbe Issue #26505: Fix typos in getaddrinfo license text.
Patch by Alex Willmer.
2016-03-07 14:51:59 -05:00
Alexander Belopolsky a2998a63c8 Closes #19475: Added timespec to the datetime.isoformat() method.
Added an optional argument timespec to the datetime isoformat() method
to choose the precision of the time component.

Original patch by Alessandro Cucci.
2016-03-06 14:58:43 -05:00
Serhiy Storchaka 5608411a96 Issue #25718: Fixed pickling and copying the accumulate() iterator with total is None. 2016-03-06 14:02:26 +02:00
Serhiy Storchaka d55162517d Issue #25718: Fixed pickling and copying the accumulate() iterator with total is None. 2016-03-06 14:00:45 +02:00
Serhiy Storchaka a0d416f0d1 Issue #26482: Allowed pickling recursive dequeues. 2016-03-06 08:55:21 +02:00
Raymond Hettinger d79d5b1a50 More logicial order. Move space saving step to just before it is used. 2016-03-04 09:55:07 -08:00
Berker Peksag 6282e656e9 Issue #26335: Make mmap.write() return the number of bytes written like
other write methods.

Patch by Jakub Stasiak.
2016-03-02 19:30:18 +02:00
Raymond Hettinger 6f86a3308a Factor-out common subexpression. 2016-03-02 00:30:58 -08:00
Raymond Hettinger 589106b206 Put block length computations in a more logical order. 2016-03-02 00:06:21 -08:00
Ned Deily 3d2778c8da Issue #26406: merge from 3.5 2016-02-23 22:10:06 +11:00
Ned Deily e1d4e58777 Issue #26406: Avoid unnecessary serialization of getaddrinfo(3) calls on
current versions of OpenBSD and NetBSD.  Patch by A. Jesse Jiryu Davis.
2016-02-23 22:05:29 +11:00
Benjamin Peterson 4a180a693f merge 3.5 (closes #25939) 2016-02-17 22:18:35 -08:00
Benjamin Peterson 1378f7ca68 merge 3.4 (closes #25939) 2016-02-17 22:18:20 -08:00
Benjamin Peterson 9491272751 open the cert store readonly
Patch from Chi Hsuan Yen.
2016-02-17 22:13:19 -08:00
Ned Deily 00538ffe3a Issue #25924: merge with 3.5 2016-02-15 16:57:04 +11:00
Ned Deily 47299fd39c Issue #25924: Avoid unnecessary serialization of getaddrinfo(3) calls on OS X
versions 10.5 or higher.  Original patch by A. Jesse Jiryu Davis.
2016-02-15 16:54:08 +11:00
Raymond Hettinger b6f17f5210 The return type of a rich comparison is an int 2016-02-14 01:41:35 -08:00
Serhiy Storchaka ffe96ae10b Issue #25994: Added the close() method and the support of the context manager
protocol for the os.scandir() iterator.
2016-02-11 13:21:30 +02:00
Martin Panter 3008b1c4bb Issue #26304: Merge doc wording from 3.5 2016-02-10 05:44:56 +00:00
Martin Panter c04fb56e36 Issue #26304: Change "allows to <verb>" to "allows <verb>ing" or similar
The original form is incorrect grammar and feels awkward, even though the
meaning is clear.
2016-02-10 05:44:01 +00:00
Martin Panter b0cb42dfdb Issue 26243: Forgot to update zlib doc strings in Argument Clinic 2016-02-10 10:45:54 +00:00
Martin Panter 1fe0d13d12 Issue #26243: zlib.compress() keyword argument support by Aviv Palivoda 2016-02-10 10:06:36 +00:00
Raymond Hettinger 38418662e0 Issue #26200: The SETREF macro adds unnecessary work in some cases. 2016-02-08 20:34:49 -08:00
Serhiy Storchaka fd625c39d0 Issue #26117: The os.scandir() iterator now closes file descriptor not only
when the iteration is finished, but when it was failed with error.
2016-02-08 17:57:22 +02:00
Serhiy Storchaka 988b9bcd88 Issue #26117: The os.scandir() iterator now closes file descriptor not only
when the iteration is finished, but when it was failed with error.
2016-02-08 17:56:36 +02:00
Serhiy Storchaka 65aaef423b Issue #25945: Fixed bugs in functools.partial.
Fixed a crash when unpickle the functools.partial object with wrong state.
Fixed a leak in failed functools.partial constructor.
"args" and "keywords" attributes of functools.partial have now always types
tuple and dict correspondingly.
2016-02-02 18:45:47 +02:00
Martin Panter 8254f793c0 Issue #26244: Merge zlib documentation from 3.5 2016-02-03 07:52:06 +00:00
Martin Panter 567d513b9b Issue #26244: Clarify default zlib compression level in documentation
Based on patch by Aviv Palivoda.
2016-02-03 07:06:33 +00:00
Serhiy Storchaka 3874128519 Issue #25945: Fixed bugs in functools.partial.
Fixed a crash when unpickle the functools.partial object with wrong state.
Fixed a leak in failed functools.partial constructor.
"args" and "keywords" attributes of functools.partial have now always types
tuple and dict correspondingly.
2016-02-02 18:45:17 +02:00
Raymond Hettinger a63897164e merge 2016-02-01 21:21:19 -08:00
Raymond Hettinger b00da57561 Issue #26194: Inserting into a full deque to raise an IndexError 2016-02-01 21:19:22 -08:00
Serhiy Storchaka 8abaa9ab34 Issue #19883: Fixed possible integer overflows in zipimport. 2016-01-28 21:32:39 +02:00
Serhiy Storchaka d5db57396b Issue #19883: Fixed possible integer overflows in zipimport. 2016-01-28 21:30:16 +02:00
Serhiy Storchaka b49a1edc15 Merge heads 2016-01-28 19:56:40 +02:00
Serhiy Storchaka d2557a67d8 Issue #26198: Added tests for "es", "et", "es#", "et#" and "C" format units
of PyArg_Parse*() functions.
2016-01-28 19:51:26 +02:00
Serhiy Storchaka c8241fdde7 Issue #26198: Added tests for "es", "et", "es#", "et#" and "C" format units
of PyArg_Parse*() functions.
2016-01-28 19:49:54 +02:00
Victor Stinner c8d2fb4112 Merge 3.5: Issue #26227 2016-01-28 15:44:10 +01:00
Victor Stinner 7240030c52 Windows: Decode hostname from ANSI code page
Issue #26227: On Windows, getnameinfo(), gethostbyaddr() and gethostbyname_ex()
functions of the socket module now decode the hostname from the ANSI code page
rather than UTF-8.
2016-01-28 15:41:01 +01:00
Raymond Hettinger 0ef0423cb2 merge 2016-01-26 21:46:03 -08:00
Raymond Hettinger 3743432302 Issue #26194: Fix undefined behavior for deque.insert() when len(d) == maxlen 2016-01-26 21:44:16 -08:00
Raymond Hettinger 1ce6885f8a Fix compiler warning about obviously unreachable code. 2016-01-24 22:15:20 -08:00
Raymond Hettinger 306d6b1ea6 Convert another post-decrement while-loop to pre-decrement for consistency
and better generated code (on both GCC and CLang).
2016-01-24 12:40:42 -08:00
Raymond Hettinger 165eee214b Convert two other post-decrement while-loops to pre-decrements for consistency
and for better code generation.
2016-01-24 11:32:07 -08:00
Raymond Hettinger d84ec225bd Miscellaneous refactorings
* Add comment to the maxlen structure entry about the meaning of maxlen == -1
* Factor-out code common to deque_append(left) and deque_extend(left)
* Factor inner-loop in deque_clear() to use only 1 test per loop instead of 2
* Tighten inner-loops for deque_item() and deque_ass_item() so that the
  compiler can combine the decrement and test into a single step.
2016-01-24 09:12:06 -08:00
Benjamin Peterson ae8c078dbb merge 3.5 2016-01-21 22:04:04 -08:00
Benjamin Peterson d52513cb22 merge 3.4 2016-01-21 22:03:55 -08:00
Benjamin Peterson b1db758061 reject negative data_size 2016-01-21 22:02:46 -08:00
Benjamin Peterson 2b0b5ac5a0 merge 3.5 (#26171) 2016-01-20 22:25:40 -08:00
Benjamin Peterson 47b8ba22e3 merge 3.4 (#26171) 2016-01-20 22:25:06 -08:00
Benjamin Peterson c4032da201 prevent buffer overflow in get_data (closes #26171) 2016-01-20 22:23:44 -08:00
Benjamin Peterson ba77788bba merge 3.5 2016-01-20 22:07:50 -08:00