Commit Graph

9399 Commits

Author SHA1 Message Date
snowapril
fa71ac9699 add missing repr on mappingproxy
Signed-off-by: snowapril <sinjihng@gmail.com>
2021-10-02 20:01:27 +09:00
Jeong YunWon
6b1af9a45e Merge pull request #3121 from Snowapril/mapping-protocol
Implement Mapping Protocol
2021-10-02 18:00:17 +09:00
Jeong YunWon
7b0965c1d7 turn unreachable function to cold 2021-10-02 18:00:04 +09:00
snowapril
a81b3f91b9 fix posix & winapi to use proper PyMapping
Signed-off-by: snowapril <sinjihng@gmail.com>
2021-10-02 16:45:35 +09:00
snowapril
aa2a7f01ee add PyMapping as PyObjectRef wrapper
Modify original `PyMapping` to `PyMappingMethods` and create `PyMapping`
struct as `PyObjectRef` wrapper for implementing `PyMapping_*`
functions. https://docs.python.org/3/c-api/mapping.html

Signed-off-by: snowapril <sinjihng@gmail.com>
2021-10-02 16:45:34 +09:00
Jeong YunWon
843a1bbc94 Merge pull request #3193 from tony-jinwoo-ahn/writeln
Replace write! with writeln!
2021-10-02 16:36:54 +09:00
Jeong YunWon
13a052b9ca Merge pull request #3094 from qingshi163/bytes-iter-pickle
General logic for positional iterator
2021-10-02 15:37:50 +09:00
Tony Jinwoo Ahn
34f5a8793a Replace write! with writeln!
Instead of calling write! with an explicit newline character at the end,
prefer its alternative, writeln!.

Signed-off-by: Tony Jinwoo Ahn <tony.jinwoo.ahn@gmail.com>
2021-10-02 15:23:11 +09:00
Jeong YunWon
b0575ccf5d Merge pull request #3191 from tony-jinwoo-ahn/Math
Enable exp() for cmath test
2021-10-02 15:13:24 +09:00
snowapril
4fd0681498 move mapping protocol to rustpython_vm::protocol
Signed-off-by: snowapril <sinjihng@gmail.com>
2021-10-02 14:47:19 +09:00
snowapril
9e5120d546 add mapping type check to mappingproxy
As in cpython implementation there exists argument type checking before
create mapping proxy like below.
```c
if (!PyMapping_Check(mapping)
    || PyList_Check(mapping)
    || PyTuple_Check(mapping))
	// print error
...
```

Signed-off-by: snowapril <sinjihng@gmail.com>
2021-10-02 14:43:20 +09:00
snowapril
6e11b8931c add mapping protocol methods to update_slot
Signed-off-by: snowapril <sinjihng@gmail.com>
2021-10-02 14:43:20 +09:00
snowapril
1fbbdaabe3 support delitem in ass_subscript 2021-10-02 14:43:20 +09:00
snowapril
4f009ef971 switch SequenceIndex to PyObjectRef
As `getitem` and `setitem methods in other types,
get second argument as PyObjectRef.
2021-10-02 14:43:20 +09:00
snowapril
b197a178ea switch RangeIndex to PyObjectRef
As `getitem` method in other types, get second argument as PyObjectRef.
2021-10-02 14:43:20 +09:00
snowapril
e83b68b810 apply mapping protocol in itemprotocol 2021-10-02 14:43:20 +09:00
snowapril
fc761b4e5b add mapping protocol to proper types 2021-10-02 14:43:20 +09:00
snowapril
1b6cdf507e rename length to compute_length
As cpython use `range_compute_length` naming
and `length` can be conflict with mapping protocol's method
2021-10-02 14:41:49 +09:00
snowapril
77351b3da8 add PyMapping struct for mapping protocol 2021-10-02 14:41:49 +09:00
snowapril
14ce6aa49a add slot_as_mapping slots with atomic cell 2021-10-02 14:41:49 +09:00
Jeong YunWon
8e5a874df1 Merge pull request #3192 from youknowone/windows-stack-size
Fix windows stack size again
2021-10-02 14:21:24 +09:00
Jeong YunWon
18b7315c9a Fix windows stack size again 2021-10-02 14:09:31 +09:00
Tony Jinwoo Ahn
8d3461d1bb Enable exp() for cmath test 2021-10-02 13:59:36 +09:00
Jeong YunWon
9656025de6 Merge pull request #3190 from RustPython/readme-env
Add RUSTPYTHONPATH note for windows users.
2021-10-02 13:31:06 +09:00
Jeong YunWon
c123ea382e Add RUSTPYTHONPATH note for windows users. 2021-10-02 13:30:36 +09:00
Jeong YunWon
5728341a17 Merge pull request #3186 from DimitrisJim/rename_arithm
Arithmatic -> Arithmetic.
2021-10-02 12:58:55 +09:00
jfh
fbd3641f5d Arithmatic into Arithmetic. 2021-10-02 03:42:59 +03:00
Jim Fasarakis-Hilliard
7ee6350285 Merge pull request #3185 from fanninpm/this-is-where-we-would-be-without-bors
Unmark passing tests in `test_cmd_line_script`
2021-10-02 03:34:19 +03:00
Padraic Fanning
c3221a0d7b Unmark passing tests 2021-10-01 19:39:57 -04:00
Kangzhi Shi
e1f689c565 introduce PyIterReturn::from_getitem_result 2021-10-01 21:16:43 +02:00
Kangzhi Shi
350c4de4e5 rebase to use PyIterReturn 2021-10-01 20:46:17 +02:00
Noa
b38ce3dbd3 Merge pull request #3158 from RustPython/pip-warnings
Miscellaneous pip fixes
2021-10-01 13:34:52 -05:00
Jim Fasarakis-Hilliard
2a31646d2f Merge pull request #3181 from emhagman/cmath-sinh-cosh
Add sinh and cosh to cmath implementation
2021-10-01 21:03:31 +03:00
Eric Hagman
014dc9d20f fix: run cargo fmt 2021-10-01 13:04:56 -04:00
Kangzhi Shi
bff00893e2 fixup clippy 2021-10-01 16:53:47 +02:00
Kangzhi Shi
87edbfece7 fix str iterator position 2021-10-01 16:53:47 +02:00
Kangzhi Shi
70fc910268 refactor set_state 2021-10-01 16:53:47 +02:00
Kangzhi Shi
b4cbca0e8c rename functions for cached iter and reversed 2021-10-01 16:53:47 +02:00
Kangzhi Shi
a0d9ce030f fix setstate saturated 2021-10-01 16:53:47 +02:00
Kangzhi Shi
fa8df88b5d optimize avoid lookup for builtin iter and reversed 2021-10-01 16:53:47 +02:00
Kangzhi Shi
8b9c33c12a Refactor rwlock -> mutex because multiple read is rare 2021-10-01 16:53:47 +02:00
Kangzhi Shi
1ade56fa84 fix deque reversed iterator use the back counting 2021-10-01 16:53:47 +02:00
Kangzhi Shi
eab3609bde fix __length_hint__ 2021-10-01 16:53:47 +02:00
Kangzhi Shi
1cd3d03951 fix deadlock and clear up 2021-10-01 16:53:47 +02:00
Kangzhi Shi
4676dd902e clear up dictdatatype and fix arithmetic overflow 2021-10-01 16:53:47 +02:00
Kangzhi Shi
b6fa8670e8 Refactor IterStatus with generic payload 2021-10-01 16:53:43 +02:00
Kangzhi Shi
547e19b493 Refactor IterStatus to hold the PyObjectRef 2021-10-01 16:53:25 +02:00
Eric Hagman
e3e4071a00 fix: remove custom tests from cmath 2021-10-01 10:52:34 -04:00
Kangzhi Shi
563c04dea9 Refactor PyListIterator with PositionIterInternal 2021-10-01 16:52:11 +02:00
Kangzhi Shi
329afeaf15 Fix __length_hint__ to return not_implemented 2021-10-01 16:51:43 +02:00