summaryrefslogtreecommitdiff
path: root/Python/bltinmodule.c
Commit message (Collapse)AuthorAgeFilesLines
* bpo-40334: Support type comments (GH-19780)Guido van Rossum2020-04-301-5/+1
| | | | | | | | | | This implements full support for # type: <type> comments, # type: ignore <stuff> comments, and the func_type parsing mode for ast.parse() and compile(). Closes https://github.com/we-like-parsers/cpython/issues/95. (For now, you need to use the master branch of mypy, since another issue unique to 3.9 had to be fixed there, and there's no mypy release yet.) The only thing missing is `feature_version=N`, which is being tracked in https://github.com/we-like-parsers/cpython/issues/124.
* bpo-40334: Use old compiler when compile mode is func_type (GH-19692)Guido van Rossum2020-04-231-1/+1
| | | | | This is invoked by mypy, using ast.parse(source, "<func_type>", "func_type"). Since the new grammar doesn't yet support the func_type_input start symbol we must use the old compiler in this case to prevent a crash. https://bugs.python.org/issue40334
* bpo-40334: Rename PyConfig.use_peg to _use_peg_parser (GH-19670)Victor Stinner2020-04-231-3/+3
| | | | | | | | | | | * Rename PyConfig.use_peg to _use_peg_parser * Document PyConfig._use_peg_parser and mark it a deprecated * Mark -X oldparser option and PYTHONOLDPARSER env var as deprecated in the documentation. * Add use_old_parser() and skip_if_new_parser() to test.support * Remove sys.flags.use_peg: use_old_parser() uses _testinternalcapi.get_configs() instead. * Enhance test_embed tests * subprocess._args_from_interpreter_flags() copies -X oldparser
* bpo-40334: PEP 617 implementation: New PEG parser for CPython (GH-19503)Pablo Galindo2020-04-221-0/+5
| | | | Co-authored-by: Guido van Rossum <guido@python.org> Co-authored-by: Lysandros Nikolaou <lisandrosnik@gmail.com>
* bpo-39562: Prevent collision of future and compiler flags (GH-19230)Batuhan Taşkaya2020-04-221-1/+1
| | | | | | The constant values of future flags in the __future__ module is updated in order to prevent collision with compiler flags. Previously PyCF_ALLOW_TOP_LEVEL_AWAIT was clashing with CO_FUTURE_DIVISION.
* bpo-40268: Remove a few pycore_pystate.h includes (GH-19510)Victor Stinner2020-04-141-1/+1
|
* bpo-40268: Add _PyInterpreterState_GetConfig() (GH-19492)Victor Stinner2020-04-131-1/+1
| | | | | | | | Don't access PyInterpreterState.config member directly anymore, but use new functions: * _PyInterpreterState_GetConfig() * _PyInterpreterState_SetConfig() * _Py_GetConfig()
* bpo-39245: Switch to public API for Vectorcall (GH-18460)Petr Viktorin2020-02-111-8/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The bulk of this patch was generated automatically with: for name in \ PyObject_Vectorcall \ Py_TPFLAGS_HAVE_VECTORCALL \ PyObject_VectorcallMethod \ PyVectorcall_Function \ PyObject_CallOneArg \ PyObject_CallMethodNoArgs \ PyObject_CallMethodOneArg \ ; do echo $name git grep -lwz _$name | xargs -0 sed -i "s/\b_$name\b/$name/g" done old=_PyObject_FastCallDict new=PyObject_VectorcallDict git grep -lwz $old | xargs -0 sed -i "s/\b$old\b/$new/g" and then cleaned up: - Revert changes to in docs & news - Revert changes to backcompat defines in headers - Nudge misaligned comments
* bpo-39573: Use Py_TYPE() macro in Python and Include directories (GH-18391)Victor Stinner2020-02-071-8/+8
| | | Replace direct access to PyObject.ob_type with Py_TYPE().
* bpo-39542: Declare _Py_AddToAllObjects() in pycore_object.h (GH-18368)Victor Stinner2020-02-051-1/+2
| | | | | | _Py_AddToAllObjects() is used in bltinmodule.c and typeobject.c when Py_TRACE_REFS is defined. Fix Py_TRACE_REFS build.
* Update sum comment. (#18240)Brandt Bucher2020-02-011-1/+5
|
* bpo-39200: Correct the error message for min/max builtin function (GH-17814)Dong-hee Na2020-01-101-2/+7
| | | | Correct the error message when calling the min() or max() with no arguments.
* bpo-38835: Don't use PyFPE_START_PROTECT and PyFPE_END_PROTECT (GH-17231)Victor Stinner2019-11-201-4/+0
| | | | | The PyFPE_START_PROTECT() and PyFPE_END_PROTECT() macros are empty: they have been doing nothing for the last year (since commit 735ae8d139a673b30b321dc10acfd3d14f0d633b), so stop using them.
* bpo-38644: Add _PyObject_Call() (GH-17089)Victor Stinner2019-11-141-7/+8
| | | | | | | | | | * Add pycore_call.h internal header file. * Add _PyObject_Call(): PyObject_Call() with tstate * Add _PyObject_CallNoArgTstate(): _PyObject_CallNoArg() with tstate * Add _PyObject_FastCallDictTstate(): _PyObject_FastCallDict() with tstate * _PyObject_Call_Prepend() now takes tstate * Replace _PyObject_FastCall() calls with _PyObject_VectorcallTstate() calls
* Correct signature of __build_class__ (GH-16735)Pablo Galindo2019-10-131-1/+1
|
* Shorter docstring (GH-16322)Raymond Hettinger2019-09-211-2/+2
|
* bpo-38237: Make pow's arguments have more descriptive names and be keyword ↵Ammar Askar2019-09-201-8/+8
| | | | | | | | | | | | passable (GH-16302) Edit: `math.pow` changes removed on Mark's request. https://bugs.python.org/issue38237 Automerge-Triggered-By: @rhettinger
* bpo-37206: Unrepresentable default values no longer represented as None. ↵Serhiy Storchaka2019-09-141-3/+3
| | | | | | | (GH-13933) In ArgumentClinic, value "NULL" should now be used only for unrepresentable default values (like in the optional third parameter of getattr). "None" should be used if None is accepted as argument and passing None has the same effect as not passing the argument at all.
* bpo-36781: Optimize sum() for bools. (#13074)Serhiy Storchaka2019-09-101-2/+2
| | | | | | | | * Optimize sum() for bools. * Fix sum([], False). * Add a NEWS entry.
* bpo-15999: Clean up of handling boolean arguments. (GH-15610)Serhiy Storchaka2019-09-011-13/+7
| | | | | | * Use the 'p' format unit instead of manually called PyObject_IsTrue(). * Pass boolean value instead 0/1 integers to functions that needs boolean. * Convert some arguments to boolean only once.
* bpo-37994: Fix silencing all errors if an attribute lookup fails. (GH-15630)Serhiy Storchaka2019-09-011-6/+2
| | | Only AttributeError should be silenced.
* bpo-37976: Prevent shadowing of TypeError in zip() (GH-15592)Sergey Fedoseev2019-08-291-4/+0
|
* Adjust builtins.zip() docstring to better communicate its signature (GH-14833)Sergey Fedoseev2019-07-181-1/+1
|
* bpo-37337: Add _PyObject_CallMethodNoArgs() (GH-14267)Jeroen Demeyer2019-07-081-6/+6
|
* bpo-37483: add _PyObject_CallOneArg() function (#14558)Jeroen Demeyer2019-07-041-5/+4
|
* bpo-37363: Add audit events for a range of modules (GH-14301)Steve Dower2019-06-241-0/+5
|
* bpo-36710: Use tstate in pylifecycle.c (GH-14249)Victor Stinner2019-06-201-2/+2
| | | | In pylifecycle.c: pass tstate argument, rather than interp argument, to functions.
* bpo-37253: Add _PyCompilerFlags_INIT macro (GH-14018)Victor Stinner2019-06-131-6/+3
| | | | | Add a new _PyCompilerFlags_INIT macro to initialize PyCompilerFlags variables, rather than initializing cf_flags and cf_feature_version explicitly in each variable.
* bpo-35766: compile(): rename feature_version parameter (GH-13994)Victor Stinner2019-06-121-2/+3
| | | | | | Rename compile() feature_version parameter to _feature_version and convert it to a keyword-only parameter. Update also test_type_comments to pass feature_version as a tuple.
* bpo-36974: tp_print -> tp_vectorcall_offset and tp_reserved -> tp_as_async ↵Jeroen Demeyer2019-05-301-6/+6
| | | | | | | | | (GH-13464) Automatically replace tp_print -> tp_vectorcall_offset tp_compare -> tp_as_async tp_reserved -> tp_as_async
* bpo-36974: implement PEP 590 (GH-13185)Jeroen Demeyer2019-05-291-2/+2
| | | | | Co-authored-by: Jeroen Demeyer <J.Demeyer@UGent.be> Co-authored-by: Mark Shannon <mark@hotpy.org>
* bpo-37001: Makes symtable.symtable have parity with compile for input (#13483)Dino Viehland2019-05-281-52/+3
| | | | | | | * Makes symtable.symtable have parity for accepted datatypes for source code as compile() * Add NEWS blurb
* bpo-36763: Implement the PEP 587 (GH-13592)Victor Stinner2019-05-271-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Add a whole new documentation page: "Python Initialization Configuration" * PyWideStringList_Append() return type is now PyStatus, instead of int * PyInterpreterState_New() now calls PyConfig_Clear() if PyConfig_InitPythonConfig() fails. * Rename files: * Python/coreconfig.c => Python/initconfig.c * Include/cpython/coreconfig.h => Include/cpython/initconfig.h * Include/internal/: pycore_coreconfig.h => pycore_initconfig.h * Rename structures * _PyCoreConfig => PyConfig * _PyPreConfig => PyPreConfig * _PyInitError => PyStatus * _PyWstrList => PyWideStringList * Rename PyConfig fields: * use_module_search_paths => module_search_paths_set * module_search_path_env => pythonpath_env * Rename PyStatus field: _func => func * PyInterpreterState: rename core_config field to config * Rename macros and functions: * _PyCoreConfig_SetArgv() => PyConfig_SetBytesArgv() * _PyCoreConfig_SetWideArgv() => PyConfig_SetArgv() * _PyCoreConfig_DecodeLocale() => PyConfig_SetBytesString() * _PyInitError_Failed() => PyStatus_Exception() * _Py_INIT_ERROR_TYPE_xxx enums => _PyStatus_TYPE_xxx * _Py_UnixMain() => Py_BytesMain() * _Py_ExitInitError() => Py_ExitStatusException() * _Py_PreInitializeFromArgs() => Py_PreInitializeFromBytesArgs() * _Py_PreInitializeFromWideArgs() => Py_PreInitializeFromArgs() * _Py_PreInitialize() => Py_PreInitialize() * _Py_RunMain() => Py_RunMain() * _Py_InitializeFromConfig() => Py_InitializeFromConfig() * _Py_INIT_XXX() => _PyStatus_XXX() * _Py_INIT_FAILED() => _PyStatus_EXCEPTION() * Rename 'err' PyStatus variables to 'status' * Convert RUN_CODE() macro to config_run_code() static inline function * Remove functions: * _Py_InitializeFromArgs() * _Py_InitializeFromWideArgs() * _PyInterpreterState_GetCoreConfig()
* bpo-36842: Implement PEP 578 (GH-12613)Steve Dower2019-05-231-2/+28
| | | Adds sys.audit, sys.addaudithook, io.open_code, and associated C APIs.
* bpo-36791: Safer detection of integer overflow in sum(). (GH-13080)Serhiy Storchaka2019-05-051-3/+5
|
* bpo-35975: Support parsing earlier minor versions of Python 3 (GH-12086)Guido van Rossum2019-03-071-2/+9
| | | | | | | This adds a `feature_version` flag to `ast.parse()` (documented) and `compile()` (hidden) that allow tweaking the parser to support older versions of the grammar. In particular if `feature_version` is 5 or 6, the hacks for the `async` and `await` keyword from PEP 492 are reinstated. (For 7 or higher, these are unconditionally treated as keywords, but they are still special tokens rather than `NAME` tokens that the parser driver recognizes.) https://bugs.python.org/issue35975
* bpo-36030: Remove _PyStack_AsTuple() and _PyStack_AsTupleSlice() (GH-12032)Sergey Fedoseev2019-02-251-1/+2
|
* bpo-35459: Use PyDict_GetItemWithError() instead of PyDict_GetItem(). (GH-11112)Serhiy Storchaka2019-02-251-3/+14
|
* bpo-35766: Merge typed_ast back into CPython (GH-11645)Guido van Rossum2019-01-311-4/+16
|
* bpo-35582: Inline arguments tuple unpacking in handwritten code. (GH-11524)Serhiy Storchaka2019-01-121-13/+18
| | | | | Inline PyArg_UnpackTuple() and _PyArg_UnpackStack() in performance sensitive code in the builtins and operator modules.
* bpo-33012: Fix invalid function cast warnings with gcc 8. (GH-6749)Serhiy Storchaka2018-11-271-9/+9
| | | | | | Fix invalid function cast warnings with gcc 8 for method conventions different from METH_NOARGS, METH_O and METH_VARARGS excluding Argument Clinic generated code.
* bpo-35177, Python-ast.h: Fix "Yield" compiler warning (GH-10664)Victor Stinner2018-11-221-0/+1
| | | | | | | | Partially revert commit 5f2df88b63e50d23914e97ec778861a52abdeaad: add "#undef Yield" to .c files after including Python-ast.h. Fix the warning: winbase.h(102): warning C4005: 'Yield': macro redefinition
* bpo-35081: Rename internal headers (GH-10275)Victor Stinner2018-11-121-1/+1
| | | | | | | | | | | | | | Rename Include/internal/ headers: * pycore_hash.h -> pycore_pyhash.h * pycore_lifecycle.h -> pycore_pylifecycle.h * pycore_mem.h -> pycore_pymem.h * pycore_state.h -> pycore_pystate.h Add missing headers to Makefile.pre.in and PCbuild: * pycore_condvar.h. * pycore_hamt.h * pycore_pyhash.h
* bpo-35177: Add dependencies between header files (GH-10361)Victor Stinner2018-11-121-9/+2
| | | | | | | | | | | | | | * ast.h now includes Python-ast.h and node.h * parsetok.h now includes node.h and grammar.h * symtable.h now includes Python-ast.h * Modify asdl_c.py to enhance Python-ast.h: * Add #ifndef/#define Py_PYTHON_AST_H to be able to include the header twice * Add "extern { ... }" for C++ * Undefine "Yield" macro conflicting with winbase.h * Remove "#undef Yield" from C files, it's now done in Python-ast.h * Remove now useless includes in C files
* bpo-35081: Add pycore_ prefix to internal header files (GH-10263)Victor Stinner2018-11-011-1/+1
| | | | | | | | | | | | | | | | | | | | * Rename Include/internal/ header files: * pyatomic.h -> pycore_atomic.h * ceval.h -> pycore_ceval.h * condvar.h -> pycore_condvar.h * context.h -> pycore_context.h * pygetopt.h -> pycore_getopt.h * gil.h -> pycore_gil.h * hamt.h -> pycore_hamt.h * hash.h -> pycore_hash.h * mem.h -> pycore_mem.h * pystate.h -> pycore_state.h * warnings.h -> pycore_warnings.h * PCbuild project, Makefile.pre.in, Modules/Setup: add the Include/internal/ directory to the search paths of header files. * Update includes. For example, replace #include "internal/mem.h" with #include "pycore_mem.h".
* bpo-34637: Make the *start* argument for *sum()* visible as a keyword ↵Raymond Hettinger2018-09-121-2/+2
| | | | argument. (GH-9208)
* bpo-34523: Use _PyCoreConfig instead of globals (GH-9005)Victor Stinner2018-08-301-1/+4
| | | | | Use the core configuration of the interpreter, rather than using global configuration variables. For example, replace Py_QuietFlag with core_config->quiet.
* closes bpo-34474: Python/bltinmodule.c: Add missing NULL check in ↵Alexey Izbyshev2018-08-231-0/+5
| | | | | builtin_sum_impl() (GH-8872) Reported by Svace static analyzer.
* bpo-34170: Add Python/coreconfig.c for _PyCoreConfig (GH-8607)Victor Stinner2018-08-011-23/+0
| | | | | | | * Add Include/coreconfig.h * Move config_*() and _PyCoreConfig_*() functions from Modules/main.c to a new Python/coreconfig.c file. * Inline _Py_ReadHashSeed() into config_init_hash_seed() * Move global configuration variables to coreconfig.c
* bpo-34149: Behavior of the min/max with key=None (GH-8328)Alexander Marshalov2018-07-231-0/+4
| | | Improve consistency with the signature for sorted(), heapq.nsmallest(), heapq.nlargest(), and itertools.groupby().