Commit Graph

2663 Commits

Author SHA1 Message Date
Brett Cannon d0600ed524 Make PyCodeObject.co_extra even more private to force users through the proper API. 2016-09-07 14:30:39 -07:00
Brett Cannon 5c4de2863b Add the co_extra field and accompanying APIs to code objects.
This completes PEP 523.
2016-09-07 11:16:41 -07:00
Benjamin Peterson 5223f08e78 make _Py_static_string_init use a designated initializer 2016-09-07 10:33:28 -07:00
Benjamin Peterson 2f8bfef158 replace PY_SIZE_MAX with SIZE_MAX 2016-09-07 09:26:18 -07:00
Steve Dower f5aba58480 Issue #27959: Adds oem encoding, alias ansi to mbcs, move aliasmbcs to codec lookup 2016-09-06 19:42:27 -07:00
Victor Stinner e66987e626 os.urandom() now blocks on Linux
Issue #27776: The os.urandom() function does now block on Linux 3.17 and newer
until the system urandom entropy pool is initialized to increase the security.

This change is part of the PEP 524.
2016-09-06 16:33:52 -07:00
Benjamin Peterson ca47063998 replace Py_(u)intptr_t with the c99 standard types 2016-09-06 13:47:26 -07:00
Benjamin Peterson b9d9eeda2a require uintptr_t to exist 2016-09-06 13:33:56 -07:00
Benjamin Peterson 9b3d77052f replace Python aliases for standard integer types with the standard integer types (#17884) 2016-09-06 13:24:00 -07:00
Benjamin Peterson 88bd3edb3e only include inttypes.h (#17884) 2016-09-06 13:05:58 -07:00
Serhiy Storchaka ea525a2d1a Issue #27078: Added BUILD_STRING opcode. Optimized f-strings evaluation. 2016-09-06 22:07:53 +03:00
Benjamin Peterson 4fe55106d1 require standard int types to be defined (#17884) 2016-09-06 11:58:01 -07:00
Benjamin Peterson af580dff4a replace PY_LONG_LONG with long long 2016-09-06 10:46:49 -07:00
Benjamin Peterson ed4aa83ff7 require a long long data type (closes #27961) 2016-09-05 17:44:18 -07:00
Brett Cannon 3cebf93872 Implement the frame evaluation API aspect of PEP 523. 2016-09-05 15:33:46 -07:00
Eric Snow 92a6c170e6 Issue #24254: Preserve class attribute definition order. 2016-09-05 14:50:11 -07:00
Mark Dickinson 7c4e409d07 Issue #11734: Add support for IEEE 754 half-precision floats to the struct module. Original patch by Eli Stevens. 2016-09-03 17:21:29 +01:00
Raymond Hettinger 15f44ab043 Issue #27895: Spelling fixes (Contributed by Ville Skyttä). 2016-08-30 10:47:49 -07:00
Victor Stinner e90bdb19f2 Issue #27830: Revert, remove _PyFunction_FastCallKeywords() 2016-08-25 23:26:50 +02:00
Victor Stinner 3f1057a4b6 method_call() and slot_tp_new() now uses fast call
Issue #27841: Add _PyObject_Call_Prepend() helper function to prepend an
argument to existing arguments to call a function. This helper uses fast calls.

Modify method_call() and slot_tp_new() to use _PyObject_Call_Prepend().
2016-08-25 01:04:14 +02:00
Victor Stinner 577e1f8cb4 Add _PyObject_FastCallKeywords()
Issue #27830: Similar to _PyObject_FastCallDict(), but keyword arguments are
also passed in the same C array than positional arguments, rather than being
passed as a Python dict.
2016-08-25 00:29:32 +02:00
Victor Stinner 74319ae219 Use Py_ssize_t type for number of arguments
Issue #27848: use Py_ssize_t rather than C int for the number of function
positional and keyword arguments.
2016-08-25 00:04:09 +02:00
Victor Stinner b900939186 _PyFunction_FastCallDict() supports keyword args
Issue #27809:

* Rename _PyFunction_FastCall() to _PyFunction_FastCallDict()
* Rename _PyCFunction_FastCall() to _PyCFunction_FastCallDict()
*  _PyFunction_FastCallDict() now supports keyword arguments
2016-08-22 23:15:44 +02:00
Victor Stinner 559bb6a713 Rename _PyObject_FastCall() to _PyObject_FastCallDict()
Issue #27809:

* Rename _PyObject_FastCall() function to _PyObject_FastCallDict()
* Add _PyObject_FastCall(), _PyObject_CallNoArg() and _PyObject_CallArg1()
  macros calling _PyObject_FastCallDict()
2016-08-22 22:48:54 +02:00
Nick Coghlan cbcd221de4 Merge #27782 fix from 3.5 2016-08-21 17:43:58 +10:00
Nick Coghlan 8682f578c1 Issue #27782: Fix m_methods handling in multiphase init
Multi-phase extension module import now correctly allows the
``m_methods`` field to be used to add module level functions
to instances of non-module types returned from ``Py_create_mod``.

Patch by Xiang Zhang.
2016-08-21 17:41:56 +10:00
Martin Panter 8fbab9f163 Merge spelling fixes from 3.5 2016-08-20 08:26:16 +00:00
Martin Panter d210a70dd9 Minor spelling fixes 2016-08-20 08:03:06 +00:00
Victor Stinner 8a31c82093 Fix PyObject_Call() parameter names
Issue #27128: arg=>args, kw=>kwargs.

Same change for PyEval_CallObjectWithKeywords().
2016-08-19 17:12:23 +02:00
Victor Stinner 9be7e7b52f Add _PyObject_FastCall()
Issue #27128: Add _PyObject_FastCall(), a new calling convention avoiding a
temporary tuple to pass positional parameters in most cases, but create a
temporary tuple if needed (ex: for the tp_call slot).

The API is prepared to support keyword parameters, but the full implementation
will come later (_PyFunction_FastCall() doesn't support keyword parameters
yet).

Add also:

* _PyStack_AsTuple() helper function: convert a "stack" of parameters to
  a tuple.
* _PyCFunction_FastCall(): fast call implementation for C functions
* _PyFunction_FastCall(): fast call implementation for Python functions
2016-08-19 16:11:43 +02:00
Ned Deily ac7974f778 Start 3.6.0bb1 2016-08-15 22:32:43 -04:00
Ned Deily b87d6000f3 Version bump for 3.6.0a4 2016-08-15 16:21:29 -04:00
Guido van Rossum 0a891d70de Issue #12345: Add mathemathcal constant tau to math and cmath.
Patch by Lisa Roach. See also PEP 628.
2016-08-15 09:12:52 -07:00
Ned Deily 6349612a8e Issue #10910: merge from 3.5 2016-08-15 03:23:23 -04:00
Ned Deily 3d4559936a Issue #10910: Update FreedBSD version checks for the ctype UTF-8 workaround.
The original problem has been fixed in newer versions of FreeBSD.
Patch by Dimitry Andric of the FreeBSD project.
2016-08-15 03:08:18 -04:00
Ned Deily 7659aab5e9 Issue #10910: Avoid C++ compilation errors on FreeBSD and OS X.
Patch by Ronald Oussoren.
2016-08-15 03:07:26 -04:00
Serhiy Storchaka 9171a8b4ce Issue #27574: Decreased an overhead of parsing keyword arguments in functions
implemented with using Argument Clinic.
2016-08-14 10:52:18 +03:00
Martin Panter 02b75abf73 Merge spelling and grammar fixes from 3.5 2016-08-05 01:51:39 +00:00
Martin Panter 69332c1a64 Fix spelling and grammar in documentation and code comments 2016-08-04 13:07:31 +00:00
Serhiy Storchaka 133138a284 Issue #22557: Now importing already imported modules is up to 2.5 times faster. 2016-08-02 22:51:21 +03:00
Martin Panter 8bde911115 Issue #27626: Merge spelling fixes from 3.5 2016-07-28 01:30:58 +00:00
Martin Panter eb9957065a Issue #27626: Spelling fixes in docs, comments and internal names
Based on patch by Ville Skyttä.
2016-07-28 01:11:04 +00:00
Alexander Belopolsky 5d0c598382 Closes issue #24773: Implement PEP 495 (Local Time Disambiguation). 2016-07-22 18:47:04 -04:00
Ned Deily b209392b0e Start 3.6.0a4 2016-07-12 01:14:53 -04:00
Ned Deily a731a68cf6 Version bump for 3.6.0a3 2016-07-11 15:38:40 -04:00
Larry Hastings 9bb2005459 Post-release fixups for Python 3.5.2. 2016-06-26 19:47:22 -07:00
Larry Hastings 6c1aa6ba30 Version number bump for 3.5.2 final. 2016-06-25 14:11:09 -07:00
Ned Deily 8a43f727a4 Start 3.6.0a3 2016-06-13 23:46:45 -04:00
Ned Deily fa42893546 Version bump for 3.6.0a2 2016-06-13 16:54:49 -04:00
Larry Hastings 6e9a96be9e Post-release fixups for Python 3.5.2rc1. 2016-06-12 20:22:18 -07:00
Serhiy Storchaka 64204de04c Issue #27095: Simplified MAKE_FUNCTION and removed MAKE_CLOSURE opcodes.
Patch by Demur Rumed.
2016-06-12 17:36:24 +03:00
Larry Hastings d31a255f32 Release bump for 3.5.2rc1. 2016-06-11 20:51:22 -07:00
Serhiy Storchaka 6a7506a77f Issue #27140: Added BUILD_CONST_KEY_MAP opcode. 2016-06-12 00:39:41 +03:00
Yury Selivanov 711d25db48 Merge 3.5 (issue #27243) 2016-06-09 15:13:16 -04:00
Yury Selivanov a6f6edbda8 Issue #27243: Fix __aiter__ protocol 2016-06-09 15:08:31 -04: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 f22e360895 merge 3.5 2016-06-03 22:38:10 -07:00
Benjamin Peterson 3da82067c7 fix indentation of comment 2016-06-03 22:37:48 -07: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
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
Ned Deily 786ed5537c Post-release cleanup: 3.6.0a1 -> 3.6.0a2 2016-05-17 16:55:41 -04:00
Ned Deily cec00a7d87 Version bump for 3.6.0a1 2016-05-16 16:03:51 -04: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
Serhiy Storchaka dd40fc3e57 Issue #26765: Moved common code and docstrings for bytes and bytearray methods
to bytes_methods.c.
2016-05-04 22:23:26 +03:00
Serhiy Storchaka b608196b20 Fixed declarations of _Py_DumpTraceback() and _Py_DumpTracebackThreads(). 2016-05-01 13:07:14 +03:00
Serhiy Storchaka f5f37d784b Fixed declarations of _Py_DumpTraceback() and _Py_DumpTracebackThreads(). 2016-05-01 13:06:43 +03: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 cda80940ed Issue #15984: Merge PyUnicode doc from 3.5 2016-04-15 02:27:11 +00:00
Martin Panter 20d325574e Issue #15984: Correct PyUnicode_FromObject() and _FromEncodedObject() docs 2016-04-15 00:56:21 +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
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 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 c86c91aab0 Merge typo fixes from 3.5 2016-04-05 06:20:32 +00:00
Martin Panter cc71a795df Fix typos in documentation and comments 2016-04-05 06:19:42 +00:00
Ned Deily 0a85c69f1d Revert back to 3.6.0, buildbots do not want chocolate for 04-01 2016-03-31 19:20:03 -04:00
Victor Stinner 49f324f1d4 Python 8: no pep8, no chocolate! 2016-03-31 23:30:53 +02:00
Victor Stinner 228ca33470 Merge 3.5 (pystate.h) 2016-03-25 01:26:35 +01:00
Victor Stinner 4b8b86c6d5 pystate.h: fix _PyThreadState_UncheckedGet()
Declare the function even if thread support is disabled.
2016-03-25 00:54:18 +01:00
Victor Stinner bd31b7c483 Issue #23848: Expose _Py_DumpHexadecimal()
This function will be reused by faulthandler.
2016-03-23 10:32:26 +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 f9a71153e9 Issue #26588: remove debug traces from _tracemalloc. 2016-03-22 23:54:42 +01:00
Victor Stinner ff9c5346ea Issue #26588: fix compilation on Windows 2016-03-22 16:29:02 +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 af4a1f20ba fix indentation in Py_DECREF() 2016-03-19 10:33:50 +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 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 89e7cdcb9c Enhance and rewrite traceback dump C functions
Issue #26564:

* Expose _Py_DumpASCII() and _Py_DumpDecimal() in traceback.h
* Change the type of the second _Py_DumpASCII() parameter from int to unsigned
  long
* Rewrite _Py_DumpDecimal() and dump_hexadecimal() to write directly characters
  in the expected order, avoid the need of reversing the string.
* dump_hexadecimal() limits width to the size of the buffer
* _Py_DumpASCII() does nothing if the object is not a Unicode string
* dump_frame() wrtites "???" as the line number if the line number is negative
2016-03-15 21:49:37 +01:00
Victor Stinner 8a1be61849 Add more checks on the GIL
Issue #10915, #15751, #26558:

* PyGILState_Check() now returns 1 (success) before the creation of the GIL and
  after the destruction of the GIL. It allows to use the function early in
  Python initialization and late in Python finalization.
* Add a flag to disable PyGILState_Check(). Disable PyGILState_Check() when
  Py_NewInterpreter() is called
* Add assert(PyGILState_Check()) to: _Py_dup(), _Py_fstat(), _Py_read()
  and _Py_write()
2016-03-14 22:07:55 +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
Yury Selivanov d2dc15b26b Merge 3.5 (issue #25888) 2016-03-02 11:31:06 -05: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 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
Victor Stinner f2c1aa1661 Add ast.Constant
Issue #26146: Add a new kind of AST node: ast.Constant. It can be used by
external AST optimizers, but the compiler does not emit directly such node.

An optimizer can replace the following AST nodes with ast.Constant:

* ast.NameConstant: None, False, True
* ast.Num: int, float, complex
* ast.Str: str
* ast.Bytes: bytes
* ast.Tuple if items are constants too: tuple
* frozenset

Update code to accept ast.Constant instead of ast.Num and/or ast.Str:

* compiler
* docstrings
* ast.literal_eval()
* Tools/parser/unparse.py
2016-01-26 00:40:57 +01:00
Victor Stinner b02ef715a3 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