Commit Graph

6096 Commits

Author SHA1 Message Date
Kangzhi Shi
fdd82fac78 fixup 2021-11-27 14:09:43 +02:00
Kangzhi Shi
9a2eef6fab fix compile 2021-11-27 13:49:05 +02:00
Kangzhi Shi
ca4e8f50e8 refactor ItemProtocol -> Object Protocol 2021-11-27 13:00:37 +02:00
Kangzhi Shi
0f3569a1b1 refactor mapping protocol 2021-11-23 20:22:01 +02:00
Chris Moradi
a685b236f9 Merge branch 'main' of github.com:chrismoradi/RustPython into unimplemented-abstract-methods-raise-error 2021-11-22 14:58:17 -08:00
Steve Shi
908b239572 Refactor and new sequence traits, generic sequence operation (#3445)
* refactor sequence generic mutable sequence item equal op

* sequence generic for pydeque

* replace usize::MAX with Optioned

* sequence op for array

* fix overflow error instead memory error for  index overflow

* fixup

* optimize reserve vec for imul
2021-11-22 09:21:23 +02:00
Noa
a53451bd10 Merge pull request #3386 from coolreader18/no-arc
Big overhaul part 1 - replace PyRc with manual RefCount + WeakRefList
2021-11-21 17:43:50 -06:00
Jeong YunWon
b8624c617b Merge pull request #3454 from YYun-D/doc_modify
Fix `bytearray` and `bytes` docs
2021-11-21 13:58:34 +09:00
YYun-D
7de142fcd1 remove bytearray and byte docs
Signed-off-by: YYun-D <yeo1998@naver.com>
2021-11-21 12:37:01 +09:00
Jeong YunWon
7305be893a Merge pull request #3451 from waroad/enumerate_add_reduce
add reduce in enumerate
2021-11-21 09:42:34 +09:00
waroad
51e1d7607c add reduce in enumerate 2021-11-20 20:56:26 +09:00
yyun-d
fd3a0f6d86 implement reduce method to PySlice
Signed-off-by: yyun-d <yeo1998@naver.com>
2021-11-20 18:59:18 +09:00
BongYang
7b79c09c3c pystr.rs isdecimal() checks not only ASCII but also Unicode decimals 2021-11-20 16:08:27 +09:00
rvsampson94
0fe8a06d65 Dict keys isdisjoint 2021-11-20 12:30:22 +09:00
Noa
790090df62 Apply review comments 2021-11-18 12:33:44 -06:00
Noa
af7ec416f9 Prevent edge case race condition, hopefully 2021-11-15 16:08:47 -06:00
Noa
229a9c8578 Make PyRef<T> wrap a NonNull<PyObjectView<T>>
This makes debuggers (or rust-gdb, at least) more pleasant to use, since
you don't have to manually cast `PyRef<T>.obj.ptr as `*const PyObjectView<T>`
Also get rid of PyGenericObject, since it's vestigial
2021-11-15 16:08:47 -06:00
Noa
8c7def00ec Address review 2021-11-15 16:08:47 -06:00
Noa
1da239ac08 Fix clippy 2021-11-15 16:08:47 -06:00
Noa
2a87b893fb Reuse standard no-cb weakref 2021-11-15 16:08:47 -06:00
Noa
f9d9a1e15e Implement weakref._remove_dead_weakref 2021-11-15 16:08:47 -06:00
Noa
ec0a658d20 Implement weakref.getweakrefs 2021-11-15 16:08:47 -06:00
Noa
c6871166d1 Make WeakListInner a sidetable 2021-11-15 16:08:47 -06:00
Noa
0b7c0fab61 Add miri test for dropping objects 2021-11-15 16:08:47 -06:00
Noa
86edc72c7e Fix miri UB 2021-11-15 16:08:46 -06:00
Noa
65cde9a0d6 Optimize size of WeakRefList
The outer struct is only 1 word now, and inside the box it's a byte for
the mutex (which gets padded to a word) + a word for the linked list (we
don't use the tail) + a word for the pointer to the object.
2021-11-15 16:08:46 -06:00
Noa
e42a3ca48e Big overhaul part 1 - replace PyRc with manual RefCount + WeakRefList 2021-11-15 16:08:45 -06:00
Chris Moradi
b0fd51f5de address PR feedback 2021-11-15 10:09:45 -08:00
Jeong YunWon
e7fa32c687 Merge pull request #3402 from Snowapril/refactor_exceptions
Refactor duplicated codes in exception creations
2021-11-16 02:45:30 +09:00
Chris Moradi
0500aa1e59 fix formatting 2021-11-13 17:35:28 -08:00
Chris Moradi
ab58885734 Check that all abstract methods are implemented prior to instantiation 2021-11-13 17:09:26 -08:00
Steve Shi
742ea0c4fa Reimpl Buffer Protocol and memoryview support ndarray with shape, stride and suboffset (#3340)
* Fix buffer protocol and memoryview

* Fix io and array the right way to use buffer protocol

* fix rebase

* fix memoryview and introduce VecBuffer

* fix deadlock

* fix memoryview avoid double release buffer

* impl ndim buffer support

* first implement nd array for buffer and memoryview

* fix slice adjust_indices

* fix adjust_indices introduct SaturatedSliceIterator

* fix memoryview cmp

* fix adjust_indices positive_order

* fix bug mark passed test

* fix clippy

* fix set_item_slice deadlock, optimize buffer

* Delete @test_113974_tmp

* Remove vec_buffer_type

* rusty names

* impl memoryview multi index

* add comments

Co-authored-by: Jeong YunWon <jeong@youknowone.org>
2021-11-13 07:17:11 +02:00
snowapril
ab1693e131 Replace new_class to new_exception_type
Replace `new_class` method call for module-level exceptions to newly
added `new_exception_type`

Signed-off-by: snowapril <sinjihng@gmail.com>
2021-11-12 21:40:26 +09:00
snowapril
59582ed295 Add new_exception_type for module-level exception
At previous, `vm.ctx.new_class` did role for adding exception in
module-level.

This commit add `new_exception_type` for doing that part of role.
As cpython implementation, if no bases is given, pass `exception_type`
by default

Signed-off-by: snowapril <sinjihng@gmail.com>
2021-11-12 21:40:26 +09:00
snowapril
5e8d3bcacb Remove duplicated static_cell! stmts in each modules
Signed-off-by: snowapril <sinjihng@gmail.com>
2021-11-12 21:40:26 +09:00
joohongpark
5ceb2be86e fixed set.{__ror__, __sub__} operator to behave according to type 2021-11-11 16:11:48 +09:00
Noa
96a9d55a62 Merge pull request #3399 from RustPython/custom-signals
Allow sending custom signals to a vm
2021-11-10 14:25:06 -06:00
Jeong YunWon
31f619510f Merge pull request #3425 from deantvv/os-getrandom
os: implement getrandom
2021-11-10 00:52:29 +09:00
Dean Li
b6f266d3b8 os: implement getrandom 2021-11-09 11:33:51 +00:00
jfh
f4030ab1f6 Enable settime for macos. 2021-11-08 18:28:02 +02:00
Jeong YunWon
b80cec7798 Merge pull request #3423 from deantvv/os-waitstatus-to-exitcode
os: implement `os.waitstatus_to_exitcode`
2021-11-07 00:00:28 +09:00
Jeong YunWon
820a67cb7e Merge pull request #3417 from moreal/as-mapping-str
Implement `AsMapping` for `PyStr`
2021-11-06 22:36:02 +09:00
Dean Li
a762ce5426 os: implement waitstatus_to_exitcode 2021-11-06 21:04:13 +08:00
Jim Fasarakis-Hilliard
625886f339 Merge pull request #3420 from zetwhite/pos_only_arg
fix error message for checking number of positional arguments
2021-11-06 12:10:57 +02:00
Jeong YunWon
98e3d26906 Use PyPathLike::into_cstring 2021-11-06 17:17:00 +09:00
zetwhite
0523a57195 fix error message for checking number of positional arguments 2021-11-06 17:00:20 +09:00
Moreal
276608233e Implement AsMapping for PyStr 2021-11-06 15:46:41 +09:00
Dean Li
04821ce730 os: fix posix_spawn exception 2021-11-06 14:40:54 +08:00
Jeong YunWon
40fd9c2683 Merge pull request #3406 from DimitrisJim/clean_time
Clean up monotonic/perf_counter invocations.
2021-11-06 14:26:21 +09:00
Jeong YunWon
8933c7bd1e Merge pull request #3414 from DimitrisJim/operator_classes_cleanup
Clean up slots in operator.
2021-11-06 14:22:55 +09:00