Commit Graph

10042 Commits

Author SHA1 Message Date
Jeong YunWon
1681eb8c01 Merge pull request #3432 from DimitrisJim/enable_settime_macos
Enable `clock_settime` for macOS.
2021-11-09 17:34:11 +09:00
jfh
f4030ab1f6 Enable settime for macos. 2021-11-08 18:28:02 +02:00
Jeong YunWon
fddd072706 Merge pull request #3431 from DimitrisJim/freebsd_check
Add a check for freeBSD.
2021-11-09 01:09:55 +09:00
jfh
2de853435b Add a check for freeBSD. 2021-11-08 17:08:43 +02:00
Jim Fasarakis-Hilliard
310578c422 Merge pull request #3426 from devnexen/netbsd_obsd_build_fix
netbsd/openbsd build fix
2021-11-07 15:46:23 +02:00
David Carlier
d6e89301a5 netbsd/openbsd build fix 2021-11-07 12:48:34 +00: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
Jim Fasarakis-Hilliard
7f1c5ec888 Merge pull request #3422 from devnexen/fbsd_build_fix
fix freebsd build wrong imports
2021-11-06 15:10:17 +02: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
Dean Li
a762ce5426 os: implement waitstatus_to_exitcode 2021-11-06 21:04:13 +08:00
David Carlier
cf7b6eeec1 fix freebsd build wrong imports 2021-11-06 11:24:00 +00: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
d7f2e2e696 Merge pull request #3416 from deantvv/os-posix-spawn
os: fix posix_spawn exception
2021-11-06 18:53:29 +09: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
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
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
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
Jeong YunWon
c5250e2fe9 Merge pull request #3413 from DimitrisJim/remove_old_code
Remove slot_new for longrange_iterator.
2021-11-05 13:28:04 +09:00
jfh
a3daca0108 Clean up slots in operator. 2021-11-04 22:29:10 +02:00
jfh
a8a3cae61f Remove slot_new for longrange_iterator. 2021-11-04 18:45:50 +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
Jeong YunWon
2309e59a72 Merge pull request #3404 from DimitrisJim/genericalias_no_kwargs
Disallow kwargs from genericalias `__new__`.
2021-11-04 19:16:36 +09:00
Jeong YunWon
95bb1a1ffb Merge pull request #3409 from DimitrisJim/check_wasi
Add wasi check to ci.
2021-11-04 16:01:16 +09:00
jfh
25c7d82a86 Add wasi check to ci. 2021-11-04 01:21:24 +02:00
Jim Fasarakis-Hilliard
07a236f965 Merge pull request #3408 from coolreader18/fix-panic
Fix panic in debug mode
2021-11-03 21:57:53 +02:00
Noa
2c70bf26c3 Move the cfg(debug_assertions) inside the quote!} 2021-11-03 13:29:52 -05:00
Noa
f01a7b17c4 Upgrade nix 2021-11-03 13:28:41 -05:00
Jim Fasarakis-Hilliard
544fb5ffa6 Merge pull request #3407 from matthieugouel/fix_whats_left
fix `not_impl.py` path for black in `whats_left.sh`
2021-11-03 20:15:54 +02:00
matthieugouel
81a6927081 fix not_impl.py path for black 2021-11-03 17:57:48 +01: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
Jim Fasarakis-Hilliard
9d95ad248b Merge pull request #3396 from OddBloke/oddbloke/exception_module
correctly set __module__ and __name__ for builtin exceptions
2021-11-03 14:48:24 +02:00
jfh
cc3708816f Clean up monotonic/perf_counter invocations. 2021-11-03 13:43:07 +02:00
jfh
ffd7e8cdb7 Disallow kwargs from genericalias new. 2021-11-03 13:35:28 +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
Daniel Watkins
42186caade extra_tests: test stdlib exception __module__/__name__ 2021-11-02 18:28:02 -04:00
Daniel Watkins
9dce9bf0b9 correctly set __module__ and __name__ for builtin exceptions
In CPython's PyErr_NewException[0], the dotted "module.name" passed in is
split on that dot: the content before the dot is set as __module__ in
the created exception class, and the content after it is set as
__name__.

This commit mirrors that behaviour, by introducing a `module` argument
to `PyContext.new_class`: if Some("module_name") is passed, it will be
set as `__module__`.  All exception-creating uses of `new_class` are
updated to pass in their module and class names separately.

[0] https://github.com/python/cpython/blob/main/Python/errors.c#L1082-L1087
2021-11-02 18:28:02 -04: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
Jim Fasarakis-Hilliard
0de92bdc45 Merge pull request #3403 from stvsmth/benches-readme-typo
Fix typo in benches readme.
2021-11-02 16:42:55 +02:00
stvsmth
ba6f855a66 Fix typo in benches readme.
Correct the file location of the index.html file.
2021-11-02 08:37:37 -06:00
Jeong YunWon
93ef12e553 Merge pull request #3401 from coolreader18/stdlib-arrayiter
Don't create an intermediate map for rustpython_stdlib::stdlib_inits
2021-11-02 18:12:28 +09: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