Commit Graph

2023 Commits

Author SHA1 Message Date
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
e51cb82ff0 Unskip tests 2021-11-15 16:08:46 -06:00
Noa
baf581c11b Update weakref.py and _weakrefset.py to Python 3.9 2021-11-15 16:08:46 -06:00
Jeong YunWon
9fa5c5ac66 Merge pull request #3433 from deantvv/test-update
Update test for `support/os_helper.py`
2021-11-16 02:47:22 +09:00
Dean Li
a1202f5602 test: update importlib 2021-11-13 14:21:59 +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
Dean Li
c15971f18a test: update test_unicode_file 2021-11-13 04:24:06 +00:00
Dean Li
323cf44788 test: update test_urllib 2021-11-13 03:51:06 +00:00
Dean Li
2f7e695c4a test: update test_uu 2021-11-13 03:44:54 +00:00
Dean Li
bd14debebe test: update test_support 2021-11-13 03:36:25 +00:00
Dean Li
49a5805d11 test: use os_helper 2021-11-13 02:18:33 +00:00
Dean Li
ce75d5c6a2 test: os use os_helper 2021-11-13 02:18:33 +00:00
Dean Li
4bcf317fba test: move os_helper out as py3.10 2021-11-13 02:18:33 +00:00
joohongpark
5ceb2be86e fixed set.{__ror__, __sub__} operator to behave according to type 2021-11-11 16:11:48 +09:00
Dean Li
bfe10aa448 test: update test_posix.py 2021-11-06 21:04:14 +08:00
Dean Li
de4c0363bd test: update support.wait_process from py3.10 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
zetwhite
0523a57195 fix error message for checking number of positional arguments 2021-11-06 17:00:20 +09:00
Dean Li
04821ce730 os: fix posix_spawn exception 2021-11-06 14:40:54 +08:00
Jeong YunWon
976ed1d5eb Merge pull request #3412 from DimitrisJim/random_seed
Allow any object as an argument for random.seed
2021-11-06 14:24:22 +09:00
Jim Fasarakis-Hilliard
2c2656dc7a Raise value error on large precision values for float, int __format__ (#3415) 2021-11-05 21:15:49 +02:00
Daniel Watkins
14b4f0092f cformat.rs: fix remaining test_format.test_common_format failures (#3405)
* cformat.rs: refactor fill_string to take fill_with_precision

This allows it to be used with both self.min_field_width and
self.precision, which is necessary for padding out %ds with precision.

* cformat.rs: zero-pad %d entries using precision

This matches CPython's behaviour.

* cformat.rs: don't left-adjust when filling with precision

That will always be prepending 0s to %d arguments, the LEFT_ADJUST flag
will be used by a later call to `fill_string` with the 0-filled string
as the `string` param.

* floats: handle alternate form of general formatting

* cformat.rs: convert width/precision to i32

In CPython, width can be isize but precision can only be i32.  Our
implementation currently assumes the same type for both: as CPython's
tests assert on overflows for precision, but not for width, we use that
size for both.

* test_format: run test_common_format

Except for the line which raises an OverflowError in CPython, because
overflows in Rust (and therefore RustPython) abort the process
immediately.

* test_types: don't expect test_float_to_string to fail

Its string formatting usage now works as expected.
2021-11-05 12:06:58 +02:00
jfh
05c4fcf934 Allow any object as an argument for random.seed 2021-11-04 18:34:20 +02:00
jfh
aa00fe9c64 Mark failing tests in test_random. 2021-11-04 15:12:32 +02:00
jfh
950a2cfad3 Add test_random from CPython 3.8. 2021-11-04 14:56:09 +02:00
Jim Fasarakis-Hilliard
b69cfafad8 Merge pull request #3398 from deantvv/os-error-str-2
os: implement os-error-str according to CPython
2021-11-03 16:53:49 +02:00
Dean Li
db212d80ff os: implement os-error-str according to CPython
As was: "FileNotFoundError: [Errno 2] No such file or directory (os
error 2)"
To be: "FileNotFoundError: [Errno 2] No such file or directory (os
error 2): 'filename' -> 'filename2'"

Reference CPython implementation
```
if (self->filename) {
    if (self->filename2) {
        return PyUnicode_FromFormat("[Errno %S] %S: %R -> %R",
                                    OR_NONE(self->myerrno),
                                    OR_NONE(self->strerror),
                                    self->filename,
                                    self->filename2);
    } else {
        return PyUnicode_FromFormat("[Errno %S] %S: %R",
                                    OR_NONE(self->myerrno),
                                    OR_NONE(self->strerror),
                                    self->filename);
    }
}
if (self->myerrno && self->strerror)
    return PyUnicode_FromFormat("[Errno %S] %S",
                                self->myerrno, self->strerror);
```
2021-11-03 17:30:28 +08:00
Jim Fasarakis-Hilliard
612e943c6c Merge pull request #3394 from Snowapril/fix-ga-param-chaining
Fix `GenericAlias` parameter chaining
2021-11-02 23:37:38 +02:00
Jeong YunWon
d78347e7ea Merge pull request #3390 from OddBloke/oddbloke/format
cformat.rs: fixes to get two test_format.py tests passing
2021-11-02 18:10:08 +09:00
Jeong YunWon
1092f94a75 Merge pull request #3377 from fanninpm/fix-test-posixpath
Fix error and unexpected success in test_posixpath
2021-11-02 18:05:52 +09:00
Jeong YunWon
7b99d13f60 Merge pull request #3050 from RustPython/upd-deps
Run cargo update + upgrade
2021-11-02 17:58:02 +09:00
Noa
5b780e70e6 Skip panicking test 2021-11-01 20:43:46 -05:00
Daniel Watkins
c5eba15370 test_format: run test_bytes_and_bytearray_format
All the errors have now been addressed.
2021-11-01 21:34:51 -04:00
Daniel Watkins
380653b6cb cformat.rs: implement %a correctly, using builtins::ascii
The repr() of Unicode strings is the Unicode string, so the previous
code was incorrect for that case (at least).
2021-11-01 21:34:51 -04:00
Padraic Fanning
1c6851a631 Skip entire test case 2021-11-01 19:40:19 -04:00
snowapril
e2142e1d07 Remove skip decorator on window test
Signed-off-by: snowapril <sinjihng@gmail.com>
2021-11-01 15:20:55 +09:00
Daniel Watkins
156cf6bc86 stdlib/posix.rs: implement mknod 2021-10-31 09:04:56 -04:00
snowapril
73ccb565d0 remove decorators on success tests
Signed-off-by: snowapril <sinjihng@gmail.com>
2021-10-31 20:02:10 +09:00
Noa
588247c4a0 Unskip tests 2021-10-30 19:42:35 -05:00
Jeong YunWon
859744236e Merge pull request #3391 from deantvv/os-error-refactor
Refactor OSError
2021-10-30 22:40:10 +09:00
Dean Li
a59556ad25 Refactor OSError
Implement `raw_os_error_to_exc_type` to reduce duplication of errno to
exception type.
2021-10-30 17:05:54 +08:00
Jeong YunWon
2ac05aba66 Merge pull request #3381 from DimitrisJim/time_mod
Time mod additions
2021-10-30 15:42:10 +09:00
Daniel Watkins
1ea93a59d5 stdlib/io.rs: align negative-fd-from-opener exception with CPython 2021-10-28 15:05:55 -04:00
jfh
c6ac24c2f2 Clean up cfgs, handle 32bit timespec creation, skip tests for windows. 2021-10-28 21:42:40 +03:00
Jeong YunWon
35e56efa65 Merge pull request #3366 from zetwhite/dict_richcmp
Implements Comparable for PyDictKeys, PyDictItems
2021-10-28 00:41:14 +09:00
jfh
ee77f3c332 Add monotonic_ns, perf_counter, perf_counter_ns. 2021-10-27 11:54:58 +03:00
jfh
1817fd6565 Add get_clock_info. 2021-10-27 10:36:10 +03:00
Jeong YunWon
281e2ee4db Merge pull request #3378 from chrismoradi/update-collections-and-tests-from-cpython
Update collections from CPython, fix tests for UserDict/List/String
2021-10-27 02:35:06 +09:00