Victor Stinner
b1cc6ba73a
bpo-41194: Convert _ast extension to PEP 489 (GH-21293)
...
Convert the _ast extension module to PEP 489 "Multiphase
initialization". Replace the global _ast state with a module state.
2020-07-03 20:01:46 +02:00
Victor Stinner
91e1bc18bd
bpo-41194: The _ast module cannot be loaded more than once (GH-21290)
...
Fix a crash in the _ast module: it can no longer be loaded more than
once. It now uses a global state rather than a module state.
* Move _ast module state: use a global state instead.
* Set _astmodule.m_size to -1, so the extension cannot be loaded more
than once.
2020-07-03 14:15:53 +02:00
Victor Stinner
74419f0c64
bpo-41194: Pass module state in Python-ast.c (GH-21284)
...
Rework asdl_c.py to pass the module state to functions in
Python-ast.c, instead of using astmodulestate_global.
Handle also PyState_AddModule() failure in init_types().
2020-07-03 11:35:37 +02:00
Pablo Galindo
1cf15af9a6
bpo-40217: Ensure Py_VISIT(Py_TYPE(self)) is always called for PyType_FromSpec types (reverts GH-19414) (GH-20264)
...
Heap types now always visit the type in tp_traverse. See added docs for details.
This reverts commit 0169d3003b .
Automerge-Triggered-By: @encukou
2020-05-27 02:03:38 -07:00
Rémi Lapeyre
c73914a562
bpo-36290: Fix keytword collision handling in AST node constructors (GH-12382)
2020-05-24 22:12:57 +01:00
Batuhan Taskaya
091951a67c
bpo-40528: Improve and clear several aspects of the ASDL definition code for the AST (GH-19952)
2020-05-06 15:29:32 +01:00
Victor Stinner
4a21e57fe5
bpo-40268: Remove unused structmember.h includes (GH-19530)
...
If only offsetof() is needed: include stddef.h instead.
When structmember.h is used, add a comment explaining that
PyMemberDef is used.
2020-04-15 02:35:41 +02:00
Pablo Galindo
168660b547
bpo-40141: Add line and column information to ast.keyword nodes (GH-19283)
2020-04-02 00:47:39 +01:00
Serhiy Storchaka
bace59d8b8
bpo-39999: Improve compatibility of the ast module. (GH-19056)
...
* Re-add removed classes Suite, slice, Param, AugLoad and AugStore.
* Add docstrings for dummy classes.
* Add docstrings for attribute aliases.
* Set __module__ to "ast" instead of "_ast".
2020-03-22 20:33:34 +02:00
Serhiy Storchaka
6b97598fb6
bpo-39988: Remove ast.AugLoad and ast.AugStore node classes. (GH-19038)
2020-03-17 23:41:08 +02:00
Batuhan Taşkaya
4ab362cec6
bpo-39638: Keep ASDL signatures in the AST nodes (GH-18515)
2020-03-16 10:12:53 +02:00
Batuhan Taşkaya
8689209e03
bpo-39969: Remove ast.Param node class as is no longer used (GH-19020)
2020-03-15 19:32:17 +00:00
Serhiy Storchaka
13d52c2686
bpo-34822: Simplify AST for subscription. (GH-9605)
...
* Remove the slice type.
* Make Slice a kind of the expr type instead of the slice type.
* Replace ExtSlice(slices) with Tuple(slices, Load()).
* Replace Index(value) with a value itself.
All non-terminal nodes in AST for expressions are now of the expr type.
2020-03-10 18:52:34 +02:00
Serhiy Storchaka
b7e9525f9c
bpo-36287: Make ast.dump() not output optional fields and attributes with default values. (GH-18843)
...
The default values for optional fields and attributes of AST nodes are now set
as class attributes (e.g. Constant.kind is set to None).
2020-03-10 00:07:47 +02:00
Batuhan Taşkaya
d82e469048
bpo-39639: Remove the AST "Suite" node and associated code (GH-18513)
...
The AST "Suite" node is no longer used and it can be removed from the ASDL definition and related structures (compiler, visitors, ...).
Co-Authored-By: Victor Stinner <vstinner@python.org >
Co-authored-by: Brett Cannon <54418+brettcannon@users.noreply.github.com >
Co-authored-by: Pablo Galindo <Pablogsal@gmail.com >
2020-03-04 16:16:46 +00:00
Brandt Bucher
d2f9667264
bpo-38823: Fix refleaks in _ast initialization error path (GH-17276)
2020-02-06 15:45:46 +01:00
Max Bernstein
bdac32e9fe
closes bpo-38648: Remove double tp_free slot in Python-ast.c. (GH-17002)
...
This looks like a typo due to copy-paste.
2019-10-30 18:08:06 -07:00
Dong-hee Na
a05fcd3c7a
bpo-38425: Fix ‘res’ may be used uninitialized warning (GH-16688)
2019-10-10 09:41:26 +02:00
Eddie Elizondo
3368f3c6ae
bpo-38140: Make dict and weakref offsets opaque for C heap types ( #16076 )
...
* Make dict and weakref offsets opaque for C heap types
* Add news
2019-09-19 17:29:05 +01:00
Eddie Elizondo
0247e80f3c
Fix leaks in Python-ast.c ( #16127 )
2019-09-14 14:38:17 +01:00
Dino Viehland
ac46eb4ad6
bpo-38113: Update the Python-ast.c generator to PEP384 (gh-15957)
...
Summary: This mostly migrates Python-ast.c to PEP384 and removes all statics from the whole file. This modifies the generator itself that generates the Python-ast.c. It leaves in the usage of _PyObject_LookupAttr even though it's not fully PEP384 compatible (this could always be shimmed in by anyone who needs it).
2019-09-11 18:16:34 +01:00
Serhiy Storchaka
43c9731334
bpo-38083: Minor improvements in asdl_c.py and Python-ast.c. (GH-15824)
...
* Use the const qualifier for constant C strings.
* Intern field and attribute names.
* Temporary incref a borrowed reference to a list item.
2019-09-10 03:02:30 -07:00
Pablo Galindo
cd6e83b481
bpo-37593: Swap the positions of posonlyargs and args in the constructor of ast.parameters nodes (GH-14778)
...
https://bugs.python.org/issue37593
2019-07-14 16:32:18 -07:00
Victor Stinner
022ac0a497
bpo-37253: Remove PyAST_obj2mod_ex() function (GH-14020)
...
PyAST_obj2mod_ex() is similar to PyAST_obj2mod() with an additional
'feature_version' parameter which is unused.
2019-06-13 09:18:45 +02:00
Jeroen Demeyer
530f506ac9
bpo-36974: tp_print -> tp_vectorcall_offset and tp_reserved -> tp_as_async (GH-13464)
...
Automatically replace
tp_print -> tp_vectorcall_offset
tp_compare -> tp_as_async
tp_reserved -> tp_as_async
2019-05-30 19:13:39 -07:00