Commit Graph

5703 Commits

Author SHA1 Message Date
Jeong YunWon
e17d20c920 Merge pull request #3187 from DimitrisJim/use_pyint_try_to_prim
Use PyInt::try_to_primitive.
2021-10-03 03:43:26 +09:00
Jeong YunWon
93c0753da5 Remove impl TryFromObject for SequenceIndex 2021-10-03 02:18:08 +09:00
Jeong YunWon
e27b9ae32b Merge pull request #3169 from youknowone/hide-type-modules
pub(crate) for type modules
2021-10-03 02:03:06 +09:00
jfh
2f6deb8fd0 Use PyInt::try_to_primitive. 2021-10-02 19:19:28 +03:00
Jeong YunWon
001236e0ab pub(crate) for type modules 2021-10-03 00:15:15 +09:00
Jim Fasarakis-Hilliard
12d765fce3 Merge pull request #3196 from Snowapril/fix_pystruct
Fix pystruct incompatibility and add `test_buffer.py` from cpython 3.8
2021-10-02 17:27:21 +03:00
Jim Fasarakis-Hilliard
c991dff54b Merge pull request #3197 from Snowapril/mapping_proxy_repr
Add missing `repr` for `mappingproxy`
2021-10-02 16:02:06 +03:00
Jim Fasarakis-Hilliard
0edb11ac1e Merge pull request #3195 from youknowone/py-names
clean up py* attributes names
2021-10-02 16:00:10 +03:00
ChJR
fad0b6b944 Change posix.*chmod 2021-10-02 20:29:54 +09:00
snowapril
fa71ac9699 add missing repr on mappingproxy
Signed-off-by: snowapril <sinjihng@gmail.com>
2021-10-02 20:01:27 +09:00
snowapril
2b3b5fbab6 fix pystruct to use struct.error
Signed-off-by: snowapril <sinjihng@gmail.com>
2021-10-02 19:38:16 +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
Jeong YunWon
2c8020a081 clean up py* attributes names 2021-10-02 16:59:33 +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
13a052b9ca Merge pull request #3094 from qingshi163/bytes-iter-pickle
General logic for positional iterator
2021-10-02 15:37:50 +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
jfh
fbd3641f5d Arithmatic into Arithmetic. 2021-10-02 03:42:59 +03: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
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
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
Kangzhi Shi
bf04b505b1 Refactor positional iterator with general logic 2021-10-01 16:51:39 +02:00
Kangzhi Shi
4e6c451b2a Impl pickling for bytes and bytearray 2021-10-01 16:49:27 +02:00
Jeong YunWon
ff1129adb7 PyIterReturn for StopIteration
Same as ArithmaticValue for NotImplemented
2021-10-01 22:33:57 +09:00