Commit Graph

4858 Commits

Author SHA1 Message Date
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 3116cc44af Fix os.set_inheritable() on Android
Issue #27057: Fix os.set_inheritable() on Android, ioctl() is blocked by
SELinux and fails with EACCESS. The function now falls back to fcntl().

Patch written by Michał Bednarski.
2016-05-19 16:46:18 +02:00
Benjamin Peterson ed64d6b4a5 regen importlib bytecode 2016-05-16 22:54:05 -07:00
Benjamin Peterson ad887cf7d1 fix possible refleak in MAKE_FUNCTION (closes #26991)
Patch by Xiang Zhang.
2016-05-16 22:52:40 -07:00
Martin Panter 4c35964b76 Corrections for a/an in code comments and documentation 2016-05-08 13:53:41 +00:00
Serhiy Storchaka df071730bb Regenerate Argument Clinic code for issue #26874. 2016-05-01 20:33:24 +03:00
Berker Peksag ec766d3c15 Issue #23960: Cleanup args and kwargs on error in PyErr_SetImportError
Patch by Ofer Schwarz.
2016-05-01 09:06:36 +03:00
Zachary Ware 7f227d9087 Issue #26874: Simplify the divmod docstring 2016-04-28 14:39:50 -05:00
Zachary Ware 4d4160af6a Issue #26874: Fix divmod docstring 2016-04-28 14:24:55 -05: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 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
Victor Stinner 9d24271d86 Fix os.urandom() on Solaris 11.3
Issue #26735: Fix os.urandom() on Solaris 11.3 and newer when reading more than
1,024 bytes: call getrandom() multiple times with a limit of 1024 bytes per
call.
2016-04-12 22:28:49 +02: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 fc43511867 Issue #25339: PYTHONIOENCODING now has priority over locale in setting the
error handler for stdin and stdout.
2016-04-10 14:34:13 +03:00
Serhiy Storchaka 48842714b9 Issue #22570: Renamed Py_SETREF to Py_XSETREF. 2016-04-06 09:45:48 +03:00
Victor Stinner 244e12088d Use Py_uintptr_t for atomic pointers
Issue #26161: Use Py_uintptr_t instead of void* for atomic pointers in
pyatomic.h. Use atomic_uintptr_t when <stdatomic.h> is used.

Using void* causes compilation warnings depending on which implementation of
atomic types is used.
2016-01-22 14:09:55 +01:00
Victor Stinner a2e5e044af Py_FatalError: disable faulthandler earlier
Issue #26563: Py_FatalError: disable faulthandler before trying to flush
sys.stdout and sys.stderr.
2016-03-16 23:19:15 +01:00
Victor Stinner 4ddee7f5fd Fix Py_FatalError() if called without the GIL
Issue #26558: If Py_FatalError() is called without the GIL, don't try to print
the current exception, nor try to flush stdout and stderr: only dump the
traceback of Python threads.
2016-03-14 16:53:12 +01:00
Yury Selivanov c724bae51c coroutines: Error when awaiting on coroutine that's being awaited
Issue #25888
2016-03-02 11:30:46 -05:00
Martin Panter 3263f6874a Issue #22836: Keep exception reports sensible despite errors 2016-02-28 03:16:11 +00:00
Brett Cannon 4f38cb41fe Issue #26367: Have importlib.__init__() raise RuntimeError when
'level' is specified but no __package__.

This brings the function inline with builtins.__import__(). Thanks to
Manuel Jacob for the patch.
2016-02-20 12:52:06 -08:00
Serhiy Storchaka 48a583b1d8 Issue #25698: Prevent possible replacing imported module with the empty one
if the stack is too deep.
2016-02-10 10:31:20 +02:00
Serhiy Storchaka c4b813d05d Issue #26198: Fixed error messages for some argument parsing errors.
Fixed the documented about buffer overflow error for "es#" and "et#" format
units.
2016-02-08 01:06:11 +02:00
Martin Panter b5944220ab Issue #4806: Avoid masking original TypeError in call with * unpacking
Based on patch by Hagen Fürstenau and Daniel Urban.
2016-01-31 06:30:56 +00:00
Victor Stinner 3cdd5fb970 code_richcompare() now uses the constants types
Issue #25843: When compiling code, don't merge constants if they are equal but
have a different types. For example, "f1, f2 = lambda: 1, lambda: 1.0" is now
correctly compiled to two different functions: f1() returns 1 (int) and f2()
returns 1.0 (int), even if 1 and 1.0 are equal.

Add a new _PyCode_ConstantKey() private function.
2016-01-22 12:33:12 +01:00
Victor Stinner bfd316e750 Add _PyThreadState_UncheckedGet()
Issue #26154: Add a new private _PyThreadState_UncheckedGet() function which
gets the current thread state, but don't call Py_FatalError() if it is NULL.

Python 3.5.1 removed the _PyThreadState_Current symbol from the Python C API to
no more expose complex and private atomic types. Atomic types depends on the
compiler or can even depend on compiler options. The new function
_PyThreadState_UncheckedGet() allows to get the variable value without having
to care of the exact implementation of atomic types.

Changes:

* Replace direct usage of the _PyThreadState_Current variable with a call to
  _PyThreadState_UncheckedGet().
* In pystate.c, replace direct usage of the _PyThreadState_Current variable
  with the PyThreadState_GET() macro for readability.
* Document also PyThreadState_Get() in pystate.h
2016-01-20 11:12:38 +01:00
Benjamin Peterson 4c70293755 merge 3.4 2016-01-01 10:25:12 -06:00
Benjamin Peterson e8c2a957c8 merge 3.3 2016-01-01 10:24:21 -06:00
Benjamin Peterson 75e3630c60 2016 will be another year of writing copyrighted code 2016-01-01 10:23:45 -06:00
Benjamin Peterson 3cc8f4b969 make recording and reporting errors and nonlocal and global directives more robust (closes #25973) 2015-12-29 10:08:34 -06:00
Serhiy Storchaka 191321d11b Issue #20440: More use of Py_SETREF.
This patch is manually crafted and contains changes that couldn't be handled
automatically.
2015-12-27 15:41:34 +02:00
Serhiy Storchaka 4a1e70fc31 Issue #20440: Applied yet one patch for using Py_SETREF.
The patch is automatically generated, it replaces the code that uses Py_CLEAR.
2015-12-27 12:36:18 +02:00
Serhiy Storchaka 5a57ade58e Issue #20440: Massive replacing unsafe attribute setting code with special
macro Py_SETREF.
2015-12-24 10:35:59 +02:00
Serhiy Storchaka 225821c653 Issue #25899: Converted non-ASCII characters in docstrings and manpage
to ASCII replacements.  Original patch by Chris Angelico.
2015-12-18 13:05:04 +02:00
Martin Panter 6f9b010242 Fix a couple of typos in code comments 2015-12-17 10:18:28 +00:00
Victor Stinner c379ade1bb pytime.c: rename pygettimeofday_new() to pygettimeofday()
I forgot to rename it in my previous refactoring of pytime.c.
2015-11-10 12:11:39 +01:00
Martin Panter eeb896c411 Issue #24802: Copy bytes-like objects to null-terminated buffers if necessary
This avoids possible buffer overreads when int(), float(), compile(), exec()
and eval() are passed bytes-like objects. Similar code is removed from the
complex() constructor, where it was not reachable.

Patch by John Leitch, Serhiy Storchaka and Martin Panter.
2015-11-07 02:32:21 +00:00
Victor Stinner f9827ea618 Issue #25555: Fix parser and AST: fill lineno and col_offset of "arg" node when
compiling AST from Python objects.
2015-11-06 17:01:48 +01:00
Martin Panter 61d6e4ae9d Issue #24802: Merge null termination fixes from 3.4 into 3.5 2015-11-07 02:56:11 +00:00
Victor Stinner 60a1d3cd15 Issue #25556: Fix LOAD_GLOBAL bytecode when globals type is not dict and the
requested name doesn't exist in globals: clear the KeyError exception before
calling PyObject_GetItem(). Fail also if the raised exception is not a
KeyError.
2015-11-05 13:55:20 +01:00
Martin Panter 2eb819f7a8 Issue #25523: Merge "a" to "an" fixes from 3.4 into 3.5 2015-11-02 04:04:57 +00:00
Martin Panter 7462b64911 Issue #25523: Correct "a" article to "an" article
This changes the main documentation, doc strings, source code comments, and a
couple error messages in the test suite. In some cases the word was removed
or edited some other way to fix the grammar.
2015-11-02 03:37:02 +00:00
Victor Stinner 50856d5ae7 sys.setrecursionlimit() now raises RecursionError
Issue #25274: sys.setrecursionlimit() now raises a RecursionError if the new
recursion limit is too low depending at the current recursion depth. Modify
also the "lower-water mark" formula to make it monotonic. This mark is used to
decide when the overflowed flag of the thread state is reset.
2015-10-13 00:11:21 +02:00
Victor Stinner bc5b80bac1 Close #24784: Fix compilation without thread support
Add "#ifdef WITH_THREAD" around cals to:

* PyGILState_Check()
* _PyImport_AcquireLock()
* _PyImport_ReleaseLock()
2015-10-11 09:54:42 +02:00
Martin Panter e02f8fc44d Issue #24402: Merge input() fix from 3.4 into 3.5 2015-10-10 01:55:23 +00:00
Martin Panter c9a6ab56cf Issue #24402: Fix input() when stdout.fileno() fails; diagnosed by Eryksun
Also factored out some test cases into a new PtyTests class.
2015-10-10 01:25:38 +00:00
Martin Panter 3f930dcd87 Merge typo fixes from 3.4 into 3.5 2015-10-07 11:01:47 +00:00
Martin Panter 9955a373a8 Various minor typos in documentation and comments 2015-10-07 10:26:23 +00:00
Serhiy Storchaka 0b40aab6f0 Issue #25280: Import trace messages emitted in verbose (-v) mode are no
longer formatted twice.
2015-10-01 11:40:22 +03:00
Serhiy Storchaka f731bc09fa Issue #25280: Import trace messages emitted in verbose (-v) mode are no
longer formatted twice.
2015-10-01 11:08:50 +03:00