Commit Graph

8938 Commits

Author SHA1 Message Date
Jeong YunWon
e1afef106a PyValue::_into_ref 2021-08-28 14:18:55 +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
Jeong YunWon
cc77ebe6ae Merge pull request #2962 from Snowapril/fix-issubclass
Fix `issubclass` method work for general types
2021-08-27 22:30:29 +09:00
snowapril
e208138d62 skip test_infinite_recursion_in_bases test in win32
Signed-off-by: snowapril <sinjihng@gmail.com>
2021-08-27 21:04:33 +09:00
snowapril
535f0734a0 remove expected_failure annotation
Signed-off-by: snowapril <sinjihng@gmail.com>
2021-08-27 19:28:01 +09:00
snowapril
323b5f7c22 add extra test test issubclass on general type
Signed-off-by: snowapril <sinjihng@gmail.com>
2021-08-27 19:28:01 +09: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
Noa
3836580de0 Merge pull request #2975 from youknowone/isinstance
hide builtins::isinstance from rust interface
2021-08-26 17:05:47 -05: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
23b77b94d5 Merge pull request #2971 from DimitrisJim/rlcompleter
Add rlcompleter.py
2021-08-27 01:55:42 +09: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
jfh
11349db67b Update test_deque to CPython 3.8 2021-08-26 19:06:41 +03:00
Moreal
46cbce49c2 Add comma for compatibility 2021-08-27 00:12:38 +09:00
jfh
4911f17ed2 Mark failing test. 2021-08-26 17:52:29 +03:00
jfh
27c0ff849b Add test_rlcompleter.py from CPython 3.8. 2021-08-26 17:51:55 +03:00
jfh
5cefa72dd4 Add rlcompleter.py from CPython 3.8. 2021-08-26 17:51:16 +03:00
Jim Fasarakis-Hilliard
9203cb3bb2 Merge pull request #2949 from stromberger/main
added __add__ method to collections.deque
2021-08-26 17:43:43 +03: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
Jeong YunWon
dc25d5442e Merge pull request #2966 from Snowapril/fix-range-iter
Disable `range_iterator` and `longrange_iterator` creation by calling its type
2021-08-26 18:31:47 +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
9ddc6ba0d6 Unmark fixed test 2021-08-26 00:30:08 +09: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
snowapril
2122d91314 add expected failure annotations to fail tests
Signed-off-by: snowapril <sinjihng@gmail.com>
2021-08-25 15:15:53 +09:00
snowapril
340b3031a6 add isinstance.py test from cpython 3.8.11
Signed-off-by: snowapril <sinjihng@gmail.com>
2021-08-25 15:15:53 +09:00
snowapril
ff913baf97 add extra test for check __instancecheck__ work
Signed-off-by: snowapril <sinjihng@gmail.com>
2021-08-25 15:15:36 +09:00
Jeong YunWon
d7bacf0580 Merge pull request #2935 from zetwhite/master
os: implement os.nice
2021-08-25 14:15:31 +09:00
snowapril
7ffc33119b builtins: fix isinstance method miswork
This commit fix issue #2936.

In original codes, there are problem in both `builtins::isinstance` and
`vm.isinstance`.

`builtins::isinstance` use `single_or_tuple_any` function for checking
given object is `<class 'type'>` or if it is tuple, iterating over them
recursively.
But it did not check given object have `__instancecheck__`
if it is not `<class 'type'>`.

`vm.isinstance` get second argument as `PyTypeRef`. Because of it,
`call_special_method` use `instancecheck` of `TypeProtocol`'s one and
never reach to user defined `__instancecheck__`

Therefore I referenced cpython implementation and fix it.

Signed-off-by: snowapril <sinjihng@gmail.com>
2021-08-25 13:17:13 +09:00
Jeong YunWon
67b338863e Merge pull request #2897 from sobolevn/better-exceptions
Adds better exception macro
2021-08-25 03:22:14 +09:00
zetwhite
c57b8fbf43 Add os.nice 2021-08-25 02:35:39 +09:00
Jeong YunWon
aff0e3c2da Merge pull request #2929 from youknowone/dict
prepare extension for each dict iterator types
2021-08-25 01:19:45 +09:00
Jeong YunWon
39ddad54d4 Merge pull request #2958 from DimitrisJim/use_sequenceindex
Use SequenceIndex instead of Either.
2021-08-25 01:00:44 +09:00
jfh
ab5ccd6beb Use SequenceIndex instead of Either. 2021-08-24 18:11:49 +03:00
Jim Fasarakis-Hilliard
7f946daec4 Merge pull request #2955 from DimitrisJim/fix_empty_array_panic
Fixes panic when empty array is indexed.
2021-08-24 17:13:08 +03:00