Jeong Yunwon
6357a1acbe
clean up imports and useless allow attributes
2022-04-15 23:58:20 +09:00
Noa
f93b134b69
Split Rotate into Rotate2 & Rotate3
2022-03-11 22:01:05 -06:00
Noa
f04a305ac6
Fix augassign double-loading the container of the target
2022-03-10 13:27:38 -06:00
Noa
1188369956
Fix clippy warnings with 1.58 & convert some format strings to capture-args
2022-01-13 23:53:25 -06:00
Noa
358ce09b5c
Run cargo upgrade
2021-10-30 19:42:35 -05:00
Noa
ee8b11f5d2
Migrate to 2021 edition
2021-10-21 11:46:24 -05:00
Noa
f6101a5821
Add the __future__.annotations feature
2021-10-17 21:55:28 -05:00
Noa
27540e1d35
Add unparse feature to ast
2021-10-17 21:55:27 -05:00
Nixon Enraght-Moony
98aa4bbe06
Bless Tests
...
This was broken by 54ab9cb54a
Closes #3253
2021-10-08 23:01:28 +01:00
jfh
1f78c764ad
Fix warnings for doc build.
2021-10-07 17:37:24 +03:00
Alex Muscar
46f070b14d
Consolidate error handling for builtin "constants" mutations
...
Co-authored-by: Jeong YunWon <youknowone@users.noreply.github.com >
2021-10-05 09:11:42 +01:00
Alex Muscar
94ae5a3af8
fix: forbid stores to the __debug__ builtin #3203
...
According to [the docs][1], `__debug__` is treated as a constant by the
interpreter.
This patch adds some checks to bring RustPython's behaviour in line with
cpython's.
[1]: https://docs.python.org/3/library/constants.html#built-in-constants
2021-10-05 09:11:42 +01:00
Jeong YunWon
4c8b14d2f1
Derive Default for CompileOpts
2021-09-30 03:59:18 +09:00
Padraic Fanning
0ea56025ec
Replace master with main
...
Fixes #3067
2021-09-15 17:54:54 -04:00
Jeong YunWon
64f7599de7
Merge pull request #2980 from HyeockJinKim/debug_value
...
Raise syntax error when saving a value to __debug__.
2021-09-06 01:58:36 +09:00
HyeockJinKim
85ec817b73
remove unnecessary mut in compiler.rs
2021-09-05 17:50:08 +09:00
HyeockJinKim
e5137fd25f
Raise syntax error when saving a value to __debug__.
2021-08-27 23:48:14 +09:00
Jeong YunWon
93b91bab2d
Compiler::qualified_name as vec
2021-08-27 23:45:47 +09:00
Jeong YunWon
390005f9a8
clean up Compiler::create_qualified_name
2021-08-27 23:29:34 +09:00
Lee Dogeon
abdfe3222b
Fix __repr__, __qualname__ ( #2977 )
2021-08-27 17:07:10 +03:00
Nikita Sobolev
ba74a9a239
Fixes typos in all other files
2021-08-22 12:42:13 +09:00
snowapril
38237c30d3
compiler: add is_global() check at top of errors
...
add `!symbol.is_global()` condition check before entrying global symbol
errors
This change will decrease hot path cost.
Signed-off-by: snowapril <sinjihng@gmail.com >
2021-08-18 00:35:14 +09:00
snowapril
13bbefdd4e
compiler: impl syntax error detect for global kind
...
This commit fixes `test_global_parap_err_first` test in
[test_syntax.py](https://github.com/RustPython/RustPython/blob/master/Lib/test/test_syntax.py#L678 ) and implement the other syntax errors detection as cpython 3.8 provided for global symbol.
Below syntax error conditions are added.
* name {} is parameter and global
```python
>>>>> def test(a):
..... global a
.....
SyntaxError: name 'a' is parameter and global at line 2 column 2
global a
```
* annotated name {} can't be global
```python
>>>>> def test():
..... a: int
..... global a
.....
SyntaxError: annotated name 'a' can't be global at line 3 column 2
global a
```
* name {} is assigned to before global description
```python
>>>>> a = 100
>>>>> def test():
..... a = 10
..... global a
.....
SyntaxError: name 'a' is assigned to before global declaration at line 3 column 2
global a
```
* name {} is used prior to global declaration
```python
>>>>> a = 10
>>>>> def test():
..... print(a)
..... global a
.....
SyntaxError: name 'a' is used prior to global declaration at line 3 column 2
global a
```
Signed-off-by: snowapril <sinjihng@gmail.com >
2021-08-17 21:14:13 +09:00
Jeong YunWon
ff4efd0f60
Fix unnessessary borrow
2021-07-30 02:32:16 +09:00
Padraic Fanning
c86c7a1cfb
Fix manual_flatten Clippy warning
2021-05-07 16:57:38 -04:00
Noah
763c18d8aa
Merge pull request #2544 from RustPython/coolreader18/misc-fixes
...
Misc fixes related to IPython
2021-04-14 15:14:54 -05:00
Noah
4129f0c5c0
Fix async for compilation
2021-04-11 17:38:44 -05:00
Noah
0a4141c778
Add an ast optimizer
2021-04-05 09:46:30 -05:00
Noah
605a353bc0
Merge pull request #2518 from RustPython/get-method-opt
...
Add optimized method lookup to avoid creating intermediate method objects
2021-03-27 15:05:04 -05:00
Noah
25ecd7c38b
Upgrade dependencies
2021-03-25 08:06:56 -05:00
Noah
54ab9cb54a
Add LoadMethod and CallMethod* opcodes
2021-03-15 09:45:07 -05:00
Noah
322aba324f
Impl Eq+Hash for ConstantData, make CodeInfo.constants an IndexSet
2021-03-11 09:58:25 -06:00
Noah
86f907ec0d
Fix SetupAsyncWith stack level handling
2021-02-20 21:04:30 -06:00
Noah
afefd163a6
Merge pull request #2438 from RustPython/coolreader18/compile_call-classdef
...
Handle splat args in bases/kwargs for __build_class__
2021-02-16 17:57:26 -06:00
Noah
1d18398c66
Handle splat args in bases/kwargs for __build_class__
2021-02-15 21:39:43 -06:00
Padraic Fanning
0d7570391e
Run rustfmt
2021-02-12 16:23:06 -05:00
Noah
d940e17bf1
Implement name mangling
2021-01-26 09:59:16 -06:00
Noah
bcf58d9091
Misc fixes
2021-01-14 12:37:37 -06:00
Noah
a00135c65a
Update the compiler to use the new asdl ast types
2021-01-14 12:37:37 -06:00
Noah
b8aabb7bb7
Implement asdl in the ast and parser
2021-01-14 12:37:37 -06:00
Noah
56c225c748
Use ahash/phf in parser
2021-01-08 17:09:09 -06:00
Noah
688880c540
Use ahash in the compiler
2021-01-08 17:00:23 -06:00
Noah
559123c617
Don't push something on the stack when starting a generator
2020-12-23 17:40:33 -06:00
Noah
2123df6017
Don't keep a separate blockorder vec
2020-12-21 18:49:00 -06:00
Noah
8f536b986d
Use boxvec for frame.stack
2020-12-21 18:48:56 -06:00
Noah
32a1dd60be
Have a block-based IR for compiling, calculate max stack size
2020-12-21 18:47:58 -06:00
Noah
a5d45124fd
Update other stuff to use the root of rustpython_bytecode
2020-12-19 14:59:07 -06:00
Noah
1be79c93b0
Make Instruction only 8 bytes
2020-12-14 15:55:47 -06:00
Noah
e87144e2c5
Add flags to the MakeFunction instruction
2020-12-14 14:35:17 -06:00
Noah
9c895c268a
Add label_arg{,_mut} methods
2020-12-14 14:25:20 -06:00