Commit Graph

8696 Commits

Author SHA1 Message Date
Dean Li
3bb4e5d808 os: fix sendfile for macos
In python, `count` in `sendfile` doesn't include nbytes in headers or trailers.
But in `nix::sys::sendfile::sendfile` does.

From nix doc,
```
If any headers are specified and `count` is non-zero,
the length of the headers will be counted in the limit of total bytes sent.
```
2021-08-14 07:57:05 +08:00
Dean Li
8f4719222c os: fix sendfile arguments 2021-08-12 22:23:37 +08:00
Dean Li
b80db73af6 os: update TestSendfile from cpython 2021-08-11 20:58:13 +08:00
Jim Fasarakis-Hilliard
101fd80949 Merge pull request #2846 from Arnab1181412/master
Fixed unwrapping in frame.rs
2021-08-11 15:01:03 +03:00
Arnab1181412
49a30b9dab Fixed unwrapping in frame.rs 2021-08-11 16:52:12 +05:30
Jeong YunWon
56469ae204 Merge pull request #2843 from eldpswp99/add_deque_iadd
add deque __iadd__ method
2021-08-11 19:48:38 +09:00
eldpswp99
571d9c4994 add deque __iadd__ method 2021-08-11 18:43:31 +09:00
Jeong YunWon
9ba674a2a9 Merge pull request #2841 from sobolevn/issue-2840
Fixes that `id()` of `tuple` was changing on `* 1`
2021-08-11 17:30:16 +09:00
Nikita Sobolev
2705fb2320 Update vm/src/builtins/tuple.rs
Co-authored-by: Jim Fasarakis-Hilliard <d.f.hilliard@gmail.com>
2021-08-11 10:38:36 +03:00
Jeong YunWon
b4810f166c Merge pull request #2828 from Tetramad/float
Add __floor__ and __ceil__ to float w/ tests
2021-08-11 16:08:37 +09:00
Tetramad
d45161939d Enable __floor__, __ceil__ test snippet for float
The test of __floor__ and __ceil__ for float will be activated
when python version is greater then or equal to 3.9
2021-08-11 14:30:10 +09:00
Padraic Fanning
95b514b85d Implement __floor__ for float type
Co-authored-by: Tetramad <cbwjd777@gmail.com>
2021-08-11 14:30:10 +09:00
Padraic Fanning
fae7b0e8ed Implement __ceil__ for float type
Co-authored-by: Tetramad <cbwjd777@gmail.com>
2021-08-11 14:30:10 +09:00
Padraic Fanning
9f497fb65a Add test_float from CPython 3.9.1
Co-authored-by: Tetramad <cbwjd777@gmail.com>
2021-08-11 14:30:10 +09:00
sobolevn
7e2efb4de5 Fixes that id() of tuple was changing on * 1, refs #2840 2021-08-11 01:47:16 +03:00
Jeong YunWon
08614bfc95 Merge pull request #2830 from DimitrisJim/bytearray_init_alloc
Add __alloc__ to bytearray and fix its __init__ issues.
2021-08-11 04:10:08 +09:00
jfh
04c9ae0c83 Fix bytearray.__init__. 2021-08-10 21:03:07 +03:00
Nikita Sobolev
a4fd0144ad Fixes repr of functions defined in classes 2021-08-11 02:55:05 +09:00
leesungbin
2c6208a5f8 Add math_perm method
Co-authored-by: Jeong YunWon <youknowone@users.noreply.github.com>
2021-08-11 02:29:44 +09:00
jfh
a136db2917 Add __alloc__ for bytearray, add note to tests. 2021-08-10 19:09:22 +03:00
Jeong YunWon
4812686f38 Merge pull request #2826 from deantvv/socket-hstrerror
socket: use libc::hstrerror
2021-08-11 00:21:08 +09:00
Dean Li
e01995d07f socket: use libc::hstrerror 2021-08-10 20:31:39 +08:00
Jeong YunWon
ac0ae8bb6c Merge pull request #2823 from moreal/bugfix/missing-annotations
Add missing `__annotations__`  variable into main module
2021-08-10 20:07:01 +09:00
Lee Dogeon
eea1945469 Refactor Option<T> handling
Co-authored-by: Jeong YunWon <youknowone@users.noreply.github.com>
2021-08-10 19:14:25 +09:00
Nikita Sobolev
b33f72eb4d Adds __qualname__ to PyBoundMethod 2021-08-10 05:32:02 +09:00
Jeong YunWon
8d14cf53c5 Merge pull request #2824 from DimitrisJim/use_vm_common
Use rustpython_common via public name.
2021-08-10 04:58:29 +09:00
Jeong YunWon
49ff438278 Merge pull request #2820 from sobolevn/issue-2779
Fixes infinite recursion on `raise e from e`
2021-08-10 04:54:52 +09:00
Jeong YunWon
be0e7ce539 Merge pull request #2818 from Snowapril/fix-seq-indexing
Add __index__ operator overriding class support for SequenceIndex
2021-08-10 04:24:34 +09:00
Jeong YunWon
a611ba2e45 handle cause and context with same code block 2021-08-10 04:20:51 +09:00
jfh
91022f5808 Use rustpython_common via exported name. 2021-08-09 22:02:00 +03:00
Jeong YunWon
794d2ce2e4 Refactor SequenceIndex::try_from_object_for 2021-08-10 03:33:48 +09:00
sobolevn
83914a9f54 Fixes infinite recursion on raise e from e, refs #2779 2021-08-09 20:58:36 +03:00
Moreal
5b5da3c45d Add missing __annotations__ variable into module 2021-08-10 02:43:33 +09:00
Jim Fasarakis-Hilliard
e4be5abf4d Merge pull request #2821 from sobolevn/issue-2794
Adds `__subclasshook__` to `type`
2021-08-09 17:54:56 +03:00
sobolevn
c0f38e2263 Adds __subclasshook__ to type, refs #2794 2021-08-09 16:33:57 +03:00
snowapril
8d507a6fbc seq: add __index__ op overriding class support
This commit fix three test cases in test_index.py
* SeqTestCase.test_index
* SeqTestCase.test_wrappers
* ListTestCase.test_setdelitem

All these three cases' failures were caused by not supporting classes
that override __index__ operator when indexing sequence type.

This commit implement almost same routine with PR(#2807) which also did not
support classes which override __index__ operator in range indexing.

Signed-off-by: snowapril <sinjihng@gmail.com>
2021-08-09 21:33:53 +09:00
Jim Fasarakis-Hilliard
81200b12f4 Merge pull request #2814 from jamestwebber/unhashable-deque
implement Unhashable for collections.deque
2021-08-09 05:24:02 +03:00
Jim Fasarakis-Hilliard
430947a75e Merge pull request #2815 from jamestwebber/fix-typo
typo in slots.rs: SlotDesctuctor -> SlotDestructor
2021-08-09 04:46:07 +03:00
James Webber
596dfe1f5a un-annotate now-passing test 2021-08-08 21:45:12 -04:00
James Webber
fee5909609 SlotDesctuctor -> SlotDestructor 2021-08-08 21:05:30 -04:00
James Webber
e003f255d5 implement hashable and unhashable for collections.deque 2021-08-08 20:59:39 -04:00
Jim Fasarakis-Hilliard
9652c79f1d Merge pull request #2787 from fanninpm/test-yield-from
Add test_yield_from from CPython 3.8
2021-08-08 21:15:28 +03:00
Padraic Fanning
373aff3d69 Mark failing tests due to GitHub Actions 2021-08-08 13:23:37 -04:00
Jeong YunWon
9ac81a7781 Merge pull request #2808 from sobolevn/issue-2790
Adds `class` field to `PyGetSet` to fix `__qualname__`
2021-08-09 01:40:49 +09:00
sobolevn
e939346850 Adds class field to PyGetSet to fix __qualname__ and (in future) repr, refs #2790 2021-08-08 18:53:57 +03:00
Snowapril
89ca1db86d builtins: add __index__ overriding class support
This commit fix RangeTestCase.test_range test in test_index.py

TryFromObject implementation for RangeIndex enum did not cover classes
that override __index__ operator which cpython implementation is currently providing
(https://docs.python.org/3.8/library/operator.html#operator.__index__)

I add codes that cover upper case using vm.to_index method.

Signed-off-by: snowapril <sinjihng@gmail.com>
2021-08-08 21:27:05 +09:00
voidSatisfaction
3cd1f6b27c Add math.comb function 2021-08-08 20:04:23 +09:00
Jim Fasarakis-Hilliard
530dec5426 Merge pull request #2806 from sobolevn/issue-2762
Makes args of `type.__prepare__` optional
2021-08-08 13:33:45 +03:00
sobolevn
e5e20a53b2 Makes type.__prepare__ a classmethod, also first arg is any (not str), refs #2762 2021-08-08 12:49:41 +03:00
sobolevn
af63e83e13 Makes args of type.__prepare__ optional, refs #2762 2021-08-08 12:05:31 +03:00