summaryrefslogtreecommitdiffstats
path: root/PC/python3.def
Commit message (Collapse)AuthorAgeFilesLines
* bpo-40910: Export Py_GetArgcArgv() function (GH-20721) (GH-20723)Victor Stinner2020-06-081-0/+1
| | | | | | | | | | | | | | Export explicitly the Py_GetArgcArgv() function to the C API and document the function. Previously, it was exported implicitly which no longer works since Python is built with -fvisibility=hidden. * Add PyConfig._orig_argv member. * Py_InitializeFromConfig() no longer calls _PyConfig_Write() twice. * PyConfig_Read() no longer initializes Py_GetArgcArgv(): it is now _PyConfig_Write() responsibility. * _PyConfig_Write() result type becomes PyStatus instead of void. * Write an unit test on Py_GetArgcArgv(). (cherry picked from commit e81f6e687d0f04a45f2389d0b43fafd6d8491624)
* bpo-40428: Remove PyTuple_ClearFreeList() function (GH-19769)Victor Stinner2020-04-291-2/+0
| | | | | | | | | | | | | | | | | | | Remove the following function from the C API: * PyAsyncGen_ClearFreeLists() * PyContext_ClearFreeList() * PyDict_ClearFreeList() * PyFloat_ClearFreeList() * PyFrame_ClearFreeList() * PyList_ClearFreeList() * PySet_ClearFreeList() * PyTuple_ClearFreeList() Make these functions private, move them to the internal C API and change their return type to void. Call explicitly PyGC_Collect() to free all free lists. Note: PySet_ClearFreeList() did nothing.
* bpo-39481: Implementation for PEP 585 (#18239)Guido van Rossum2020-04-071-0/+2
| | | | | | | | | | | | This implements things like `list[int]`, which returns an object of type `types.GenericAlias`. This object mostly acts as a proxy for `list`, but has attributes `__origin__` and `__args__` that allow recovering the parts (with values `list` and `(int,)`. There is also an approximate notion of type variables; e.g. `list[T]` has a `__parameters__` attribute equal to `(T,)`. Type variables are objects of type `typing.TypeVar`.
* bpo-38644: Add Py_EnterRecursiveCall() to python3.def (GH-18399)Victor Stinner2020-02-071-0/+2
| | | | Add Py_EnterRecursiveCall and Py_LeaveRecursiveCall functions to python3.def.
* bpo-38896: Remove PyUnicode_ClearFreeList() function (GH-17354)Victor Stinner2019-11-231-1/+0
| | | | Remove PyUnicode_ClearFreeList() function: the Unicode free list has been removed in Python 3.3.
* bpo-37757: Disallow PEP 572 cases that expose implementation details (GH-15131)Nick Coghlan2019-08-251-1/+0
| | | | | | | | | | | | | | | - drop TargetScopeError in favour of raising SyntaxError directly as per the updated PEP 572 - comprehension iteration variables are explicitly local, but named expression targets in comprehensions are nonlocal or global. Raise SyntaxError as specified in PEP 572 - named expression targets in the outermost iterable of a comprehension have an ambiguous target scope. Avoid resolving that question now by raising SyntaxError. PEP 572 originally required this only for cases where the bound name conflicts with the iteration variable in the comprehension, but CPython can't easily restrict the exception to that case (as it doesn't know the target variable names when visiting the outermost iterator expression)
* Bump to 3.9.0a0Łukasz Langa2019-06-041-799/+799
|
* bpo-35224: PEP 572 Implementation (#10497)Emily Morehouse2019-01-241-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Add tokenization of := - Add token to Include/token.h. Add token to documentation in Doc/library/token.rst. - Run `./python Lib/token.py` to regenerate Lib/token.py. - Update Parser/tokenizer.c: add case to handle `:=`. * Add initial usage of := in grammar. * Update Python.asdl to match the grammar updates. Regenerated Include/Python-ast.h and Python/Python-ast.c * Update AST and compiler files in Python/ast.c and Python/compile.c. Basic functionality, this isn't scoped properly * Regenerate Lib/symbol.py using `./python Lib/symbol.py` * Tests - Fix failing tests in test_parser.py due to changes in token numbers for internal representation * Tests - Add simple test for := token * Tests - Add simple tests for named expressions using expr and suite * Tests - Update number of levels for nested expressions to prevent stack overflow * Update symbol table to handle NamedExpr * Update Grammar to allow assignment expressions in if statements. Regenerate Python/graminit.c accordingly using `make regen-grammar` * Tests - Add additional tests for named expressions in RoundtripLegalSyntaxTestCase, based on examples and information directly from PEP 572 Note: failing tests are currently commented out (4 out of 24 tests currently fail) * Tests - Add temporary syntax test failure tests in test_parser.py Note: There is an outstanding TODO for this -- syntax tests need to be moved to a different file (presumably test_syntax.py), but this is covering what needs to be tested at the moment, and it's more convenient to run a single test for the time being * Add support for allowing assignment expressions as function argument annotations. Uncomment tests for these cases because they all pass now! * Tests - Move existing syntax tests out of test_parser.py and into test_named_expressions.py. Refactor syntax tests to use unittest * Add TargetScopeError exception to extend SyntaxError Note: This simply creates the TargetScopeError exception, it is not yet used anywhere * Tests - Update tests per PEP 572 Continue refactoring test suite: The named expression test suite now checks for any invalid cases that throw exceptions (no longer limited to SyntaxErrors), assignment tests to ensure that variables are properly assigned, and scope tests to ensure that variable availability and values are correct Note: - There are still tests that are marked to skip, as they are not yet implemented - There are approximately 300 lines of the PEP that have not yet been addressed, though these may be deferred * Documentation - Small updates to XXX/todo comments - Remove XXX from child description in ast.c - Add comment with number of previously supported nested expressions for 3.7.X in test_parser.py * Fix assert in seq_for_testlist() * Cleanup - Denote "Not implemented -- No keyword args" on failing test case. Fix PEP8 error for blank lines at beginning of test classes in test_parser.py * Tests - Wrap all file opens in `with...as` to ensure files are closed * WIP: handle f(a := 1) * Tests and Cleanup - No longer skips keyword arg test. Keyword arg test now uses a simpler test case and does not rely on an external file. Remove print statements from ast.c * Tests - Refactor last remaining test case that relied on on external file to use a simpler test case without the dependency * Tests - Add better description of remaning skipped tests. Add test checking scope when using assignment expression in a function argument * Tests - Add test for nested comprehension, testing value and scope. Fix variable name in skipped comprehension scope test * Handle restriction of LHS for named expressions - can only assign to LHS of type NAME. Specifically, restrict assignment to tuples This adds an alternative set_context specifically for named expressions, set_namedexpr_context. Thus, context is now set differently for standard assignment versus assignment for named expressions in order to handle restrictions. * Tests - Update negative test case for assigning to lambda to match new error message. Add negative test case for assigning to tuple * Tests - Reorder test cases to group invalid syntax cases and named assignment target errors * Tests - Update test case for named expression in function argument - check that result and variable are set correctly * Todo - Add todo for TargetScopeError based on Guido's comment (https://github.com/python/cpython/commit/2b3acd37bdfc2d35e5094228c6684050d2aa8b0a#r30472562) * Tests - Add named expression tests for assignment operator in function arguments Note: One of two tests are skipped, as function arguments are currently treating an assignment expression inside of parenthesis as one child, which does not properly catch the named expression, nor does it count arguments properly * Add NamedStore to expr_context. Regenerate related code with `make regen-ast` * Add usage of NamedStore to ast_for_named_expr in ast.c. Update occurances of checking for Store to also handle NamedStore where appropriate * Add ste_comprehension to _symtable_entry to track if the namespace is a comprehension. Initialize ste_comprehension to 0. Set set_comprehension to 1 in symtable_handle_comprehension * s/symtable_add_def/symtable_add_def_helper. Add symtable_add_def to handle grabbing st->st_cur and passing it to symtable_add_def_helper. This now allows us to call the original code from symtable_add_def by instead calling symtable_add_def_helper with a different ste. * Refactor symtable_record_directive to take lineno and col_offset as arguments instead of stmt_ty. This allows symtable_record_directive to be used for stmt_ty and expr_ty * Handle elevating scope for named expressions in comprehensions. * Handle error for usage of named expression inside a class block * Tests - No longer skip scope tests. Add additional scope tests * Cleanup - Update error message for named expression within a comprehension within a class. Update comments. Add assert for symtable_extend_namedexpr_scope to validate that we always find at least a ModuleScope if we don't find a Class or FunctionScope * Cleanup - Add missing case for NamedStore in expr_context_name. Remove unused var in set_namedexpr_content * Refactor - Consolidate set_context and set_namedexpr_context to reduce duplicated code. Special cases for named expressions are handled by checking if ctx is NamedStore * Cleanup - Add additional use cases for ast_for_namedexpr in usage comment. Fix multiple blank lines in test_named_expressions * Tests - Remove unnecessary test case. Renumber test case function names * Remove TargetScopeError for now. Will add back if needed * Cleanup - Small comment nit for consistency * Handle positional argument check with named expression * Add TargetScopeError exception definition. Add documentation for TargetScopeError in c-api docs. Throw TargetScopeError instead of SyntaxError when using a named expression in a comprehension within a class scope * Increase stack size for parser by 200. This is a minimal change (approx. 5kb) and should not have an impact on any systems. Update parser test to allow 99 nested levels again * Add TargetScopeError to exception_hierarchy.txt for test_baseexception.py_ * Tests - Major update for named expression tests, both in test_named_expressions and test_parser - Add test for TargetScopeError - Add tests for named expressions in comprehension scope and edge cases - Add tests for named expressions in function arguments (declarations and call sites) - Reorganize tests to group them more logically * Cleanup - Remove unnecessary comment * Cleanup - Comment nitpicks * Explicitly disallow assignment expressions to a name inside parentheses, e.g.: ((x) := 0) - Add check for LHS types to detect a parenthesis then a name (see note) - Add test for this scenario - Update tests for changed error message for named assignment to a tuple (also, see note) Note: This caused issues with the previous error handling for named assignment to a LHS that contained an expression, such as a tuple. Thus, the check for the LHS of a named expression must be changed to be more specific if we wish to maintain the previous error messages * Cleanup - Wrap lines more strictly in test file * Revert "Explicitly disallow assignment expressions to a name inside parentheses, e.g.: ((x) := 0)" This reverts commit f1531400ca7d7a2d148830c8ac703f041740896d. * Add NEWS.d entry * Tests - Fix error in test_pickle.test_exceptions by adding TargetScopeError to list of exceptions * Tests - Update error message tests to reflect improved messaging convention (s/can't/cannot) * Remove cases that cannot be reached in compile.c. Small linting update. * Update Grammar/Tokens to add COLONEQUAL. Regenerate all files * Update TargetScopeError PRE_INIT and POST_INIT, as this was purposefully left out when fixing rebase conflicts * Add NamedStore back and regenerate files * Pass along line number and end col info for named expression * Simplify News entry * Fix compiler warning and explicity mark fallthrough
* bpo-33738: Fix macros which contradict PEP 384 (GH-7477)Christian Tismer2018-06-091-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | During development of the limited API support for PySide, we saw an error in a macro that accessed a type field. This patch fixes the 7 errors in the Python headers. Macros which were not written as capitals were implemented as function. To do the necessary analysis again, a script was included that parses all headers and looks for "->tp_" in serctions which can be reached with active limited API. It is easily possible to call this script as a test. Error listing: ../../Include/objimpl.h:243 #define PyObject_IS_GC(o) (PyType_IS_GC(Py_TYPE(o)) && \ (Py_TYPE(o)->tp_is_gc == NULL || Py_TYPE(o)->tp_is_gc(o))) Action: commented only ../../Include/objimpl.h:362 #define PyType_SUPPORTS_WEAKREFS(t) ((t)->tp_weaklistoffset > 0) Action: commented only ../../Include/objimpl.h:364 #define PyObject_GET_WEAKREFS_LISTPTR(o) \ ((PyObject **) (((char *) (o)) + Py_TYPE(o)->tp_weaklistoffset)) Action: commented only ../../Include/pyerrors.h:143 #define PyExceptionClass_Name(x) \ ((char *)(((PyTypeObject*)(x))->tp_name)) Action: implemented function ../../Include/abstract.h:593 #define PyIter_Check(obj) \ ((obj)->ob_type->tp_iternext != NULL && \ (obj)->ob_type->tp_iternext != &_PyObject_NextNotImplemented) Action: implemented function ../../Include/abstract.h:713 #define PyIndex_Check(obj) \ ((obj)->ob_type->tp_as_number != NULL && \ (obj)->ob_type->tp_as_number->nb_index != NULL) Action: implemented function ../../Include/abstract.h:924 #define PySequence_ITEM(o, i)\ ( Py_TYPE(o)->tp_as_sequence->sq_item(o, i) ) Action: commented only
* Add missed details of the C API introduced in 3.7. (GH-7047)Serhiy Storchaka2018-05-221-0/+2
| | | | | | * Set the limited API version for PyImport_GetModule and PyOS_*Fork functions. * Add PyImport_GetModule and Py_UTF8Mode in PC/python3.def. * Add several functions in Doc/data/refcounts.dat.
* Start of 3.8.0a0Ned Deily2018-01-311-793/+793
|
* bpo-30697: Fix PyErr_NormalizeException() when no memory (GH-2327)xdegaye2017-10-261-1/+0
|
* bpo-25658: Implement PEP 539 for Thread Specific Storage (TSS) API (GH-1362)Masayuki Yamamoto2017-10-061-0/+7
| | | | | | | | | 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-29102: Add a unique ID to PyInterpreterState. (#1639)Eric Snow2017-05-231-0/+1
|
* Issue #27867: Function PySlice_GetIndicesEx() is deprecated and replaced withSerhiy Storchaka2017-01-251-0/+2
|\ | | | | | | | | | | a macro if Py_LIMITED_API is not set or set to the value between 0x03050400 and 0x03060000 (not including) or 0x03060100 or higher. Added functions PySlice_Unpack() and PySlice_AdjustIndices().
| * Issue #27867: Function PySlice_GetIndicesEx() is replaced with a macro ifSerhiy Storchaka2017-01-251-0/+2
| |\ | | | | | | | | | | | | Py_LIMITED_API is not set or set to the value between 0x03050400 and 0x03060000 (not including) or 0x03060100 or higher.
| | * Issue #27867: Function PySlice_GetIndicesEx() is replaced with a macro ifSerhiy Storchaka2017-01-251-0/+2
| | | | | | | | | | | | | | | Py_LIMITED_API is not set or set to the value between 0x03050400 and 0x03060000 (not including) or 0x03060100 or higher.
* | | Issue #23903: Added missed Windows-specific names to PC/python3.def.Serhiy Storchaka2016-12-271-0/+13
|\ \ \ | |/ /
| * | Issue #23903: Added missed Windows-specific names to PC/python3.def.Serhiy Storchaka2016-12-271-0/+13
| |\ \ | | |/
| | * Issue #23903: Added missed Windows-specific names to PC/python3.def.Serhiy Storchaka2016-12-271-0/+13
| | |
* | | Issue #23903: Added missed names to PC/python3.def.Serhiy Storchaka2016-12-271-0/+64
|\ \ \ | |/ /
| * | Issue #23903: Added missed names to PC/python3.def.Serhiy Storchaka2016-12-271-0/+64
| |\ \ | | |/
| | * Issue #23903: Added missed names to PC/python3.def.Serhiy Storchaka2016-12-271-0/+59
| | |
* | | Issue #23903: Fixed errors and remove non-existing names in python3.def.Serhiy Storchaka2016-12-271-5/+3
|\ \ \ | |/ /
| * | Issue #23903: Fixed errors and remove non-existing names in python3.def.Serhiy Storchaka2016-12-271-5/+3
| |\ \ | | |/
| | * Issue #23903: Fixed errors and remove non-existing names in python3.def.Serhiy Storchaka2016-12-271-5/+3
| | |
* | | Sort and remove duplicates from PC/python3.def (issue #23903).Serhiy Storchaka2016-12-231-25/+24
|\ \ \ | |/ /
| * | Sort and remove duplicates from PC/python3.def (issue #23903).Serhiy Storchaka2016-12-231-25/+24
| |\ \ | | |/
| | * Sort and remove duplicates from PC/python3.def (issue #23903).Serhiy Storchaka2016-12-231-25/+24
| | |
* | | Bump to 3.7.0a0Ned Deily2016-09-121-710/+710
|/ /
* | Issue #5319: New Py_FinalizeEx() API to exit with status 120 on failureMartin Panter2015-11-301-0/+1
| |
* | Issue #16991: Use the correct version for master.Eric Snow2015-05-301-8/+8
| |
* | Merge from 3.5.Eric Snow2015-05-301-0/+8
|\ \ | |/
| * Issue #16991: Add PyODict* to Windows builds.Eric Snow2015-05-301-0/+8
| |
| * Reverting my previous commit.Yury Selivanov2015-05-301-701/+701
|/ | | | Something went horribly wrong when I was doing `hg rebase`.
* Update Windows build for 3.6Zachary Ware2015-05-281-701/+701
|
* Issue #24268: Adds PyModuleDef_Init and PyModuleDef_Type to python3.def ↵Steve Dower2015-05-231-0/+2
| | | | (stable ABI)
* Issue #22919: Windows build updated to support VC 14.0 (Visual Studio 2015), ↵Steve Dower2014-11-221-1/+2
| | | | which will be used for the official 3.5 release.
* Issue #18711: Add a new `PyErr_FormatV` function, similar to `PyErr_Format` ↵Antoine Pitrou2014-09-301-0/+1
| | | | but accepting a `va_list` argument.
* Bump Windows build to 3.5Zachary Ware2014-03-171-699/+699
|
* Add PyType_GetSlot to python3 def file. Patch courtesy Martin v. Löwis.Larry Hastings2014-02-101-0/+1
|
* Merge with 3.3: Issue #17432: Drop UCS2 from names of Unicode functions in ↵Martin v. Löwis2014-01-041-62/+62
|\ | | | | | | python3.def.
| * Issue #17432: Drop UCS2 from names of Unicode functions in python3.def.Martin v. Löwis2014-01-041-62/+62
| |
* | Issue #15422: get rid of PyCFunction_New macroAndrew Svetlov2012-12-251-0/+1
| |
* | Bump version to 3.4.0 alpha 0.Georg Brandl2012-09-291-697/+697
|/
* Issue #11626: Add _SizeT functions to stable ABI.Martin v. Löwis2012-06-231-0/+6
|
* Issue #15146: Add PyType_FromSpecWithBases. Patch by Robin Schreiber.Martin v. Löwis2012-06-231-0/+2
|
* Issue #15042: Add PyState_AddModule and PyState_RemoveModule.Martin v. Löwis2012-06-221-0/+2
| | | | | | Add version guard for Py_LIMITED_API additions. Issue #15081: Document PyState_FindModule. Patch by Robin Schreiber.
* More eol-style'sAntoine Pitrou2011-02-251-689/+689
|
* More automated version replacement.Georg Brandl2011-02-201-687/+687
|