summaryrefslogtreecommitdiffstats
path: root/Python
Commit message (Collapse)AuthorAgeFilesLines
* bpo-27535: Optimize warnings.warn() (#4508)Victor Stinner2017-11-221-42/+33
| | | | | | | | | | | | | * Optimize warnings.filterwarnings(). Replace re.compile('') with None to avoid the cost of calling a regex.match() method, whereas it always matchs. * Optimize get_warnings_attr(): replace PyObject_GetAttrString() with _PyObject_GetAttrId(). Cleanup also create_filter(): * Use _Py_IDENTIFIER() to allow to cleanup strings at Python finalization * Replace Py_FatalError() with a regular exceptions
* bpo-32030: Add more options to _PyCoreConfig (#4485)Victor Stinner2017-11-213-11/+11
| | | | | | Py_Main() now handles two more -X options: * -X showrefcount: new _PyCoreConfig.show_ref_count field * -X showalloccount: new _PyCoreConfig.show_alloc_count field
* bpo-32089: Fix warnings filters in dev mode (#4482)Victor Stinner2017-11-211-10/+27
| | | | | | | | | | The developer mode (-X dev) now creates all default warnings filters to order filters in the correct order to always show ResourceWarning and make BytesWarning depend on the -b option. Write a functional test to make sure that ResourceWarning is logged twice at the same location in the developer mode. Add a new 'dev_mode' field to _PyCoreConfig.
* bpo-32088: Display Deprecation in debug mode (#4474)Victor Stinner2017-11-201-0/+7
| | | | | | | | When Python is build is debug mode (Py_DEBUG), DeprecationWarning, PendingDeprecationWarning and ImportWarning warnings are now displayed by default. test_venv: run "-m pip" and "-m ensurepip._uninstall" with -W ignore::DeprecationWarning since pip code is not part of Python.
* bpo-32043: New "developer mode": "-X dev" option (#4413)Victor Stinner2017-11-161-0/+8
| | | | | | | | | | | | | Add a new "developer mode": new "-X dev" command line option to enable debug checks at runtime. Changes: * Add unit tests for -X dev * test_cmd_line: replace test.support with support. * Fix _PyRuntimeState_Fini(): Use the same memory allocator than _PyRuntimeState_Init(). * Fix _PyMem_GetDefaultRawAllocator()
* bpo-32030: Enhance Py_Main() (#4412)Victor Stinner2017-11-164-120/+84
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Parse more env vars in Py_Main(): * Add more options to _PyCoreConfig: * faulthandler * tracemalloc * importtime * Move code to parse environment variables from _Py_InitializeCore() to Py_Main(). This change fixes a regression from Python 3.6: PYTHONUNBUFFERED is now read before calling pymain_init_stdio(). * _PyFaulthandler_Init() and _PyTraceMalloc_Init() now take an argument to decide if the module has to be enabled at startup. * tracemalloc_start() is now responsible to check the maximum number of frames. Other changes: * Cleanup Py_Main(): * Rename some pymain_xxx() subfunctions * Add pymain_run_python() subfunction * Cleanup Py_NewInterpreter() * _PyInterpreterState_Enable() now reports failure * init_hash_secret() now considers pyurandom() failure as an "user error": don't fail with abort(). * pymain_optlist_append() and pymain_strdup() now sets err on memory allocation failure.
* bpo-32030: Split Py_Main() into subfunctions (#4399)Victor Stinner2017-11-156-211/+396
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Don't use "Python runtime" anymore to parse command line options or to get environment variables: pymain_init() is now a strict separation. * Use an error message rather than "crashing" directly with Py_FatalError(). Limit the number of calls to Py_FatalError(). It prepares the code to handle errors more nicely later. * Warnings options (-W, PYTHONWARNINGS) and "XOptions" (-X) are now only added to the sys module once Python core is properly initialized. * _PyMain is now the well identified owner of some important strings like: warnings options, XOptions, and the "program name". The program name string is now properly freed at exit. pymain_free() is now responsible to free the "command" string. * Rename most methods in Modules/main.c to use a "pymain_" prefix to avoid conflits and ease debug. * Replace _Py_CommandLineDetails_INIT with memset(0) * Reorder a lot of code to fix the initialization ordering. For example, initializing standard streams now comes before parsing PYTHONWARNINGS. * Py_Main() now handles errors when adding warnings options and XOptions. * Add _PyMem_GetDefaultRawAllocator() private function. * Cleanup _PyMem_Initialize(): remove useless global constants: move them into _PyMem_Initialize(). * Call _PyRuntime_Initialize() as soon as possible: _PyRuntime_Initialize() now returns an error message on failure. * Add _PyInitError structure and following macros: * _Py_INIT_OK() * _Py_INIT_ERR(msg) * _Py_INIT_USER_ERR(msg): "user" error, don't abort() in that case * _Py_INIT_FAILED(err)
* bpo-30950: Convert round() to Argument Clinic. (#2740)Serhiy Storchaka2017-11-152-20/+51
|
* bpo-32011: Revert "Issue #15480: Remove the deprecated and unused TYPE_INT64 ↵Serhiy Storchaka2017-11-151-0/+21
| | | | | | | code from marshal." (#4381) Simplify the reverted code. This reverts commit e9bbe8b87ba2874efba0474af5cc7d5941dbf742.
* bpo-32023: Disallow genexprs without parenthesis in class definitions. (#4400)Serhiy Storchaka2017-11-151-5/+10
|
* bpo-31949: Fixed several issues in printing tracebacks ↵Serhiy Storchaka2017-11-151-51/+51
| | | | | | | | | | | | (PyTraceBack_Print()). (#4289) * Setting sys.tracebacklimit to 0 or less now suppresses printing tracebacks. * Setting sys.tracebacklimit to None now causes using the default limit. * Setting sys.tracebacklimit to an integer larger than LONG_MAX now means using the limit LONG_MAX rather than the default limit. * Fixed integer overflows in the case of more than 2**31 traceback items on Windows. * Fixed output errors handling.
* bpo-32012: Disallow trailing comma after genexpr without parenthesis. (#4382)Serhiy Storchaka2017-11-151-10/+9
|
* bpo-30696: Fix the REPL looping endlessly when no memory (GH-4160)xdegaye2017-11-121-18/+42
|
* bpo-28180: Fix the implementation of PEP 538 on Android (GH-4334)xdegaye2017-11-121-12/+65
|
* bpo-31572: Get rid of _PyObject_HasAttrId() in the ASDL parser. (#3725)Serhiy Storchaka2017-11-111-610/+774
| | | Silence only expected AttributeError.
* bpo-31572: Don't silence unexpected errors in the _warnings module. (#3731)Serhiy Storchaka2017-11-111-68/+89
| | | | | Get rid of _PyObject_HasAttrId() and PyDict_GetItemString(). Silence only expected AttributeError, KeyError and ImportError when get an attribute, look up in a dict or import a module.
* Add the const qualifier to "char *" variables that refer to literal strings. ↵Serhiy Storchaka2017-11-115-5/+6
| | | | (#4370)
* Replace KB unit with KiB (#4293)Victor Stinner2017-11-083-7/+7
| | | | | | | | | | | kB (*kilo* byte) unit means 1000 bytes, whereas KiB ("kibibyte") means 1024 bytes. KB was misused: replace kB or KB with KiB when appropriate. Same change for MB and GB which become MiB and GiB. Change the output of Tools/iobench/iobench.py. Round also the size of the documentation from 5.5 MB to 5 MiB.
* bpo-31415: Improve error handling and caching of the importtime option. (#4138)Serhiy Storchaka2017-11-071-13/+20
|
* Fix miscellaneous typos (#4275)luzpaz2017-11-053-3/+3
|
* bpo-28994: PyErr_NormalizeException() no longer use C stack for recursion. ↵Serhiy Storchaka2017-11-051-39/+33
| | | | | (#2035) MemoryError raised when normalizing a RecursionError raised during exception normalization now not always causes a fatal error.
* bpo-31415: Support PYTHONPROFILEIMPORTTIME envvar equivalent to -X ↵Barry Warsaw2017-11-021-4/+11
| | | | | | importtime (#4240) Support PYTHONPROFILEIMPORTTIME envvar equivalent to -X importtime
* bpo-31784: Implement PEP 564: add time.time_ns() (#3989)Victor Stinner2017-11-021-19/+86
| | | | | | | | | | | | | | | | | | | | | | | | | Add new time functions: * time.clock_gettime_ns() * time.clock_settime_ns() * time.monotonic_ns() * time.perf_counter_ns() * time.process_time_ns() * time.time_ns() Add new _PyTime functions: * _PyTime_FromTimespec() * _PyTime_FromNanosecondsObject() * _PyTime_FromTimeval() Other changes: * Add also os.times() tests to test_os. * pytime_fromtimeval() and pytime_fromtimeval() now return _PyTime_MAX or _PyTime_MIN on overflow, rather than undefined behaviour * _PyTime_FromNanoseconds() parameter type changes from long long to _PyTime_t
* bpo-28936: Detect lexically first syntax error first (#4097)Ivan Levkivskyi2017-10-261-18/+16
| | | | Lexically first global and nonlocal syntax errors at given scope should be detected first.
* Fix trailing whitespaces in C files. (#4130)Serhiy Storchaka2017-10-261-1/+1
|
* bpo-30697: Fix PyErr_NormalizeException() when no memory (GH-2327)xdegaye2017-10-261-16/+30
|
* bpo-21720: Restore the Python 2.7 logic in handling a fromlist. (#4118)Serhiy Storchaka2017-10-261-1773/+1783
| | | | | | BytesWarning no longer emitted when the fromlist argument of __import__() or the __all__ attribute of the module contain bytes instances.
* bpo-31857: Make the behavior of USE_STACKCHECK deterministic (#4098)pdox2017-10-262-1/+4
|
* remove support for splitting the ceval switch into multiple switches (#4099)Benjamin Peterson2017-10-251-10/+0
| | | | | | | This kludge is from 1992. Any C99 compiler is going to be able to handle the ceval dispatch switch. Anyway, we have much bigger switches than the ceval dispatch one around. (See, e.g., Objects/unicodetype_db.h.)
* bpo-31845: Fix reading flags from environment (GH-4105)Nick Coghlan2017-10-251-14/+23
| | | | | | | | | | The startup refactoring means command line settings are now applied after settings are read from the environment. This updates the way command line settings are applied to account for that, ensures more settings are first read from the environment in _PyInitializeCore, and adds a simple test case covering the flags that are easy to check.
* bpo-30768: Recompute timeout on interrupted lock (GH-4103)Victor Stinner2017-10-242-10/+54
| | | | | | | | | | | | | | | | Fix the pthread+semaphore implementation of PyThread_acquire_lock_timed() when called with timeout > 0 and intr_flag=0: recompute the timeout if sem_timedwait() is interrupted by a signal (EINTR). See also the PEP 475. The pthread implementation of PyThread_acquire_lock() now fails with a fatal error if the timeout is larger than PY_TIMEOUT_MAX, as done in the Windows implementation. The check prevents any risk of overflow in PyThread_acquire_lock(). Add also PY_DWORD_MAX constant.
* bpo-30817: Fix PyErr_PrintEx() when no memory (#2526)xdegaye2017-10-231-3/+9
|
* Move exc state to generator. Fixes bpo-25612 (#1773)Mark Shannon2017-10-224-127/+64
| | | Move exception state information from frame objects to coroutine (generator/thread) object where it belongs.
* bpo-31825: Fixed OverflowError in the 'unicode-escape' codec (#4058)Serhiy Storchaka2017-10-201-1/+1
| | | | and in codecs.escape_decode() when decode an escaped non-ascii byte.
* Move opcode tracing to occur after the possible update to f_lineno. (GH-3798)George King2017-10-191-4/+4
|
* bpo-28603: Fix formatting tracebacks for unhashable exceptions (#4014)Zane Bitter2017-10-171-3/+18
|
* bpo-31786: Make functions in the select module blocking when timeout is a ↵Pablo Galindo2017-10-171-2/+15
| | | | small negative value. (#4003)
* bpo-31773: _PyTime_GetPerfCounter() uses _PyTime_t (GH-3983)Victor Stinner2017-10-162-42/+128
| | | | | | | | * Rewrite win_perf_counter() to only use integers internally. * Add _PyTime_MulDiv() which compute "ticks * mul / div" in two parts (int part and remaining) to prevent integer overflow. * Clock frequency is checked at initialization for integer overflow. * Enhance also pymonotonic() to reduce the precision loss on macOS (mach_absolute_time() clock).
* bpo-31780: Fix incorrect error message for ',x', ',b', ',o' specs (#4002)Dargor2017-10-151-2/+2
| | | Patch by Pablo.
* bpo-31773: time.perf_counter() uses again double (GH-3964)Victor Stinner2017-10-122-21/+27
| | | | | | | | time.clock() and time.perf_counter() now use again C double internally. Remove also _PyTime_GetWinPerfCounterWithInfo(): use _PyTime_GetPerfCounterDoubleWithInfo() instead on Windows.
* Cleanup pytime.c (#3955)Victor Stinner2017-10-111-54/+76
| | | | | * Move _PyTime_overflow() at the top * Move assertion on numerator into _PyTime_ObjectToDenominator() * PEP 7: add { ... } to if blocks
* bpo-31415: Add _PyTime_GetPerfCounter() and use it for -X importtime (#3936)Victor Stinner2017-10-102-12/+73
| | | | | * Add _PyTime_GetPerfCounter() * Use _PyTime_GetPerfCounter() for -X importtime
* bpo-31642: Restore blocking "from" import by setting None in sys.modules. ↵Serhiy Storchaka2017-10-081-242/+244
| | | | (#3834)
* bpo-31709: Update importlib magic (#3906)Yury Selivanov2017-10-061-104/+104
|
* bpo-25658: Implement PEP 539 for Thread Specific Storage (TSS) API (GH-1362)Masayuki Yamamoto2017-10-065-77/+228
| | | | | | | | | See PEP 539 for details. Highlights of changes: - Add Thread Specific Storage (TSS) API - Document the Thread Local Storage (TLS) API as deprecated - Update code that used TLS API to use TSS API
* bpo-31708: Allow async generator expressions in synchronous functions (#3905)Yury Selivanov2017-10-061-1/+1
|
* bpo-31709: Drop support for asynchronous __aiter__. (#3903)Yury Selivanov2017-10-062-51/+7
|
* closes bpo-31696: don't mention GCC in sys.version when building with clang ↵Benjamin Peterson2017-10-061-8/+7
| | | | (#3891)
* bpo-30406: Make async and await proper keywords (#1669)Jelle Zijlstra2017-10-062-190/+198
| | | Per PEP 492, 'async' and 'await' should become proper keywords in 3.7.
* PEP 553 built-in breakpoint() function (bpo-31353) (#3355)Barry Warsaw2017-10-052-0/+103
| | | Implement PEP 553, built-in breakpoint() with support from sys.breakpointhook(), along with documentation and tests. Closes bpo-31353