Commit Graph

5450 Commits

Author SHA1 Message Date
Jeong YunWon
ba15a23fed Merge pull request #3003 from Snowapril/time-module
Add thread_time, process_time in `time` module
2021-09-05 02:04:13 +09:00
snowapril
639ec966c1 time: add thread_time, process_time
This commits add four methods, thread_time, thread_time_ns,
process_time and process_time_ns.

With use of libc crate, we can get thread_time and process_time from the
cpu.

Signed-off-by: snowapril <sinjihng@gmail.com>
2021-09-05 01:02:08 +09:00
eldpswp99
55709b71b6 implement SlotConstructor for every class 2021-09-04 20:18:13 +09:00
Jeong YunWon
407cc7aae2 trait SlotConstructor for tp_new blueprint 2021-09-04 20:15:49 +09:00
Padraic Fanning
f833ba6ed3 Update num_bigint to 0.4.2
Fixes a compilation error with the latest nightlies.
2021-09-03 18:53:23 -04:00
Jeong YunWon
61e79ff064 Merge pull request #2997 from zetwhite/os_sched
os : implement os.sched_yield, os.sched_get_priority_min, os.sched_get_priority_max
2021-09-02 22:21:07 +09:00
Jeong YunWon
818688daab Merge pull request #2992 from moreal/bugfix/correct-object-repr
Correct `object.__repr__` format
2021-09-02 22:20:42 +09:00
zetwhite
d8bbb424ab Add os.sched_yield, os.sched_get_priority_min, os.sched_get_priority_max 2021-09-02 18:14:56 +09:00
Moreal
894fa5b0e9 Correct object.__repr__ format 2021-09-02 07:49:20 +09:00
Tony Jinwoo Ahn
c211402a76 Add documentation for a pymethod in map.rs
Signed-off-by: Tony Jinwoo Ahn <tony.jinwoo.ahn@gmail.com>
2021-09-01 23:40:12 +09:00
Jim Fasarakis-Hilliard
8473ea9911 Merge pull request #2991 from DimitrisJim/set_iter
Improve set iteration, add __reduce__
2021-09-01 12:03:46 +03:00
Moreal
9ae07543a5 Fix PyMappingProxy::get 2021-08-31 23:29:33 +09:00
jfh
049e9bd41d Add __reduce__ for set iterator. 2021-08-30 19:53:48 +03:00
jfh
3e656c0b6e Use inner dict methods during iteration. 2021-08-30 17:44:51 +03:00
Frank King
c1aaac02ed Implement array::_array_reconstructor 2021-08-30 22:21:53 +08:00
Frank King
736096976c reformat array.rs to be mod array { ... } 2021-08-30 22:21:53 +08:00
Jeong YunWon
4ddd1d3ee3 Merge pull request #2989 from DimitrisJim/repeat_overflow_checks
Check for MemoryErrors when repeating sequences.
2021-08-30 16:12:37 +09:00
Jeong YunWon
f4d40bc0c9 Merge pull request #2988 from DimitrisJim/isinstance_subclass_edges
Clean up edge cases in `isinstance`/`issubclass`.
2021-08-30 12:05:51 +09:00
jfh
97b8d7ca7b Add checking for repeat on sequences. 2021-08-29 17:43:47 +03:00
Myunghoon Park
e4953efac1 add __new__ method to deque iterator and reverse iterator (#2987)
* add __new__ method to deque iterator and reverse iterator
2021-08-29 17:13:19 +03:00
jfh
d42d048c70 Clean up edge cases in isinstance and issubclass. 2021-08-29 15:12:30 +03:00
Snowapril
2aa58cc551 implement complex.__complex__
add `complex.__complex__` which will be added in cpython 3.11 for typing
module.

documents:
* https://docs.python.org/3.11/whatsnew/3.11.html#other-cpython-implementation-changes
* https://bugs.python.org/issue24234

Signed-off-by: snowapril <sinjihng@gmail.com>
2021-08-29 11:33:56 +09:00
snowapril
cb4df01aca Implement bytes.__bytes__
This commit implement `bytes.__bytes__` in cpython 3.11 for typing
module.

* https://docs.python.org/3.11/whatsnew/3.11.html#other-cpython-implementation-changes
* https://bugs.python.org/issue24234

Signed-off-by: snowapril <sinjihng@gmail.com>
2021-08-29 07:32:21 +09:00
Jeong YunWon
7d964815cb Merge pull request #2983 from youknowone/pyref-int-ref
PyValue::_into_ref
2021-08-28 15:06:38 +09:00
Jeong YunWon
e1afef106a PyValue::_into_ref 2021-08-28 14:18:55 +09:00
jfh
2b5251a4ec Return subclass on copy. 2021-08-27 20:47:41 +03:00
Lee Dogeon
abdfe3222b Fix __repr__, __qualname__ (#2977) 2021-08-27 17:07:10 +03:00
snowapril
1ddeb67ad0 builtins: fix issubclass method miswork
This commit fix issue #2943.

In cpython, both first and second argument can be value (not type).
As second parameter `cls` is defined as PyTypeRef,
`vm.call_special_method` use `subclasscheck` method in `PyTuple`, never could reach
to user defined `subclasscheck` method.

In general, first argument of `issubclass` must be `<class Type>`, but
if second argument define `__subclasscheck__`, rustpython must test it
first. Therefore, for first argument enable to have different type, I
switch it's type as `PyObjectRef`.

Signed-off-by: snowapril <sinjihng@gmail.com>
2021-08-27 19:28:01 +09:00
Jeong YunWon
3a861e47c6 Merge pull request #2976 from DimitrisJim/bump_recursion_limit
Bump recursion limit to match CPython's
2021-08-27 16:44:58 +09:00
jfh
01e5b12290 Bump recursion limit to match CPython's 2021-08-27 09:29:52 +03:00
Jeong YunWon
f1c3935f27 Merge pull request #2961 from qingshi163/main
fix pattern for construct the bytes and bytearray
2021-08-27 10:02:02 +09:00
Jeong YunWon
6269d7eb00 hide builtins::isinstance from rust interface 2021-08-27 03:20:14 +09:00
Jeong YunWon
d387399587 simplify ByteInnerNewOptions::get_bytes() 2021-08-27 03:15:23 +09:00
Jeong YunWon
fbea3f072e Merge pull request #2952 from Snowapril/fix-isinstance
Fix `isinstance` to support Generic type object
2021-08-27 02:16:53 +09:00
Jim Fasarakis-Hilliard
48f0eb2810 Merge pull request #2972 from DimitrisJim/deque_pickle_tests
Implement __reduce__ for deque.
2021-08-26 20:03:41 +03:00
Jeong YunWon
84dd5b02ce Merge pull request #2963 from moreal/bugfix/correct-init-method-error-message
Fix missing positional argument message
2021-08-27 01:54:25 +09:00
jfh
5e758f07b5 Add deque.__reduce__. 2021-08-26 19:15:32 +03:00
Moreal
46cbce49c2 Add comma for compatibility 2021-08-27 00:12:38 +09:00
Alexander Stromberger
4e733c450b added __add__ method to collections.deque 2021-08-26 22:50:22 +09:00
Jim Fasarakis-Hilliard
c57285bd83 Merge pull request #2969 from eldpswp99/add-mutation-check-logic-in-dict-update
Add mutation check in dict.merge.
2021-08-26 16:15:28 +03:00
eldpswp99
9addff5ba9 add mutation check in dict.merge 2021-08-26 21:02:45 +09:00
Jeong YunWon
2657b8f936 Merge pull request #2968 from eldpswp99/make-dict-copy-order-when-copied-from-ordered-dict
make dict copy order when copied from ordered dict
2021-08-26 20:58:44 +09:00
Jeong YunWon
30b0a5af5e Simpler function args error formatting 2021-08-26 20:57:48 +09:00
Jeong YunWon
9f4f26300b Merge pull request #2741 from RustPython/coolreader18/fix-wasi
Fix compilation on wasi
2021-08-26 20:32:02 +09:00
eldpswp99
e7948e94a9 make dict copy order when copied from ordered dict 2021-08-26 19:55:23 +09:00
snowapril
d0afc4c3bc set range iter type not creatable by calling type
This commit fix `RangeTest.test_range_iterators_invocation` in
[`test_range.py`](https://github.com/RustPython/RustPython/blob/main/Lib/test/test_range.py#L507).

This is last `TODO` in `test_range.py`.

By add slot tp_new to both types and return new_type_error, prevent
creation of range_iterator and longrange_iterator by calling its type.

Signed-off-by: snowapril <sinjihng@gmail.com>
2021-08-26 16:15:28 +09:00
Noah
2969fa5625 Fix compilation on wasi 2021-08-25 19:58:20 -05:00
Moreal
6c9f8445e5 Fix missing positional argument message
See also https://github.com/RustPython/RustPython/issues/2939
2021-08-26 00:07:35 +09:00
Kangzhi Shi
343d158c34 fix pattern for construct the bytes and bytearray 2021-08-25 09:44:48 +02:00
Jeong YunWon
d7bacf0580 Merge pull request #2935 from zetwhite/master
os: implement os.nice
2021-08-25 14:15:31 +09:00