Commit Graph

5983 Commits

Author SHA1 Message Date
zetwhite
a3fed90fc2 Implements Comparable for PyDictKeys, PyDictItems 2021-10-24 12:26:46 +09:00
Jeong YunWon
7f0ba0c176 Merge pull request #3364 from moreal/relocate-object-repr
Relocate `vm.to_repr` to `object.repr`
2021-10-24 01:14:56 +09:00
ChJR
e139364a60 Relocate vm.issubclass to obj.is_subclass 2021-10-24 01:05:32 +09:00
Moreal
bc05b98ca6 Relocate vm.to_repr to object.repr 2021-10-23 21:16:28 +09:00
Jeong YunWon
1047cb573d Update result-like to 0.4 2021-10-23 02:49:59 +09:00
Jim Fasarakis-Hilliard
54d5966895 Merge pull request #3360 from moreal/remove-py-module-macro
Remove `py_module!` macro
2021-10-22 17:12:05 +03:00
Moreal
72a1dee5ad Remove py_module! macro 2021-10-22 22:45:38 +09:00
snowapril
d9f561caa2 add rich_compare on GenericAlias
Signed-off-by: snowapril <sinjihng@gmail.com>
2021-10-22 18:43:15 +09:00
snowapril
8607519441 add missing methods for GenericAlias
* __mro_entries__
* __instancecheck__
* __reduce__
* __subclasscheck__
* Callable slot

Signed-off-by: snowapril <sinjihng@gmail.com>
2021-10-22 18:43:15 +09:00
snowapril
dfc0cdfaf7 add exact type check and return generic alias
Signed-off-by: snowapril <sinjihng@gmail.com>
2021-10-22 18:43:15 +09:00
snowapril
32ba09c407 add missing __class_getitem__ in several types
Signed-off-by: snowapril <sinjihng@gmail.com>
2021-10-22 18:43:15 +09:00
Noa
53c261a19b Switch to array.into_iter() 2021-10-21 17:12:37 -05:00
Noa
09e9ea91e7 TryFrom, TryInto, FromIterator are in prelude now 2021-10-21 17:04:19 -05:00
Noa
80688abfcc Fix new clippy lint 2021-10-21 11:59:44 -05:00
Noa
ee8b11f5d2 Migrate to 2021 edition 2021-10-21 11:46:24 -05:00
Jeong YunWon
f76877347a Py -> PyObjectView 2021-10-21 18:04:13 +09:00
Jeong YunWon
b759808736 PyObj -> PyObject 2021-10-21 17:55:29 +09:00
Jeong YunWon
4e5f897f74 PyObject -> PyGenericObject 2021-10-21 17:42:56 +09:00
Jeong YunWon
d4feb2a6c5 incref -> to_owned 2021-10-21 17:29:34 +09:00
Noa
8dd18d97be PyObjectRef -> &PyObj, &PyRef<T> -> &Py<T> 2021-10-21 16:49:01 +09:00
Jeong YunWon
e5a1c3b137 setattro uses PyObjectPtr 2021-10-21 16:31:22 +09:00
Jeong YunWon
70f8849f05 as_buffer uses ptr 2021-10-21 16:31:22 +09:00
Jeong YunWon
08b5768a82 iternext uses ptr 2021-10-21 16:31:22 +09:00
Jeong YunWon
ad7925cac6 rich_compare uses ptr 2021-10-21 16:31:22 +09:00
Jeong YunWon
113ad3bdea as_mapping uses ptr 2021-10-21 16:31:22 +09:00
Jeong YunWon
77b904ce64 __del__ uses ptr 2021-10-21 16:31:22 +09:00
Jeong YunWon
73650259ec Callable with ptr 2021-10-21 16:31:22 +09:00
Jeong YunWon
41b02809f9 PyObjectPtr for __hash__ 2021-10-21 16:31:22 +09:00
Jeong YunWon
16efb5d878 PyObjectPtr: no RC even through function pointers 2021-10-21 16:31:22 +09:00
jfh
388f278783 Remove usage of py_module macro from ast. 2021-10-21 08:20:00 +03:00
Jeong YunWon
fd2ba5159e Merge pull request #3204 from fanninpm/cleanup-skipped-tests
Clean up some skipped tests
2021-10-21 02:39:15 +09:00
Jeong YunWon
82fac6ce53 Merge pull request #3263 from Snowapril/suggestion
Implement keyword suggestion on `PyAttributeError` and `PyNameError` from cpython 3.10
2021-10-21 02:30:46 +09:00
Jeong YunWon
5ce05fcca0 Merge pull request #3330 from deantvv/uid-gid-from-object
posix: handle case -1 for `Uid` and `Gid`
2021-10-21 01:43:52 +09:00
Jeong YunWon
946f4ecc89 Merge pull request #3334 from DimitrisJim/namespace_fixes
Namespace fixes
2021-10-21 01:35:04 +09:00
Jeong YunWon
a83ad7aa1c Merge pull request #3337 from deantvv/fix-os-putenv
os: fix putenv
2021-10-21 01:33:37 +09:00
Dean Li
c56db2fafa os: fix putenv
Check key and value before calling `env::set_var`

From doc of `env::set_var`,
```

This function may panic if `key` is empty, contains an ASCII equals sign
`'='` or the NUL character `'\0'`, or when the value contains the NUL
character.
```
2021-10-20 23:15:39 +08:00
Dean Li
86920e21e5 posix: handle case -1 for Uid and Gid
For `Uid` and `Gid`, -1 means does not change the value.
2021-10-20 22:23:36 +08:00
jfh
45b0fb3005 Fix conflict from merges. 2021-10-20 09:08:15 +03:00
Jim Fasarakis-Hilliard
0c07b7cbfc Merge pull request #3349 from AP2008/relocate-str
Relocate `vm.to_str` to `obj.str`
2021-10-20 08:54:24 +03:00
Jim Fasarakis-Hilliard
b7dab09b7d Merge pull request #3347 from AP2008/relocate-rich_compare
Relocate `vm.rich_compare` to `obj.rich_compare`
2021-10-20 08:49:40 +03:00
Jim Fasarakis-Hilliard
497eead8e9 Merge pull request #3344 from ChJR/feature/relocate_is_instance
Relocate vm.isinstance to obj.is_instance
2021-10-20 08:45:06 +03:00
Aratrik
fdd1baec65 Relocate vm.to_str to obj.str 2021-10-20 10:28:24 +05:30
Jim Fasarakis-Hilliard
a4ff86190b Merge pull request #3346 from youknowone/set-repr
set repr push to buffer directly
2021-10-20 07:54:08 +03:00
Aratrik
c427462554 Relocate vm.rich_compare to obj.rich_compare 2021-10-20 09:44:41 +05:30
snowapril
46347aa6d4 fix PyMethod::get to use vm.get_attribute
As cpython implementation, if `getattro` slot is not
`PyBaseObject::getattro`, then use `vm.get_attribute` not slot method.

Signed-off-by: snowapril <sinjihng@gmail.com>
2021-10-20 10:19:42 +09:00
snowapril
1ee74403e2 Add name field on PyNameError
Signed-off-by: snowapril <sinjihng@gmail.com>
2021-10-20 10:19:42 +09:00
snowapril
ff54d8ae53 Add name and obj attributes to PyAttributeError
Signed-off-by: snowapril <sinjihng@gmail.com>
2021-10-20 10:19:42 +09:00
snowapril
db0d9df53f Add offer_suggestions on write_exception_inner
Signed-off-by: snowapril <sinjihng@gmail.com>
2021-10-20 10:19:42 +09:00
snowapril
6339390629 Implement keyword suggestion routine
`suggestions.rs` is almost porting of implementation of
[this](https://github.com/python/cpython/pull/16856) and
[this](https://github.com/python/cpython/pull/25397).

Signed-off-by: snowapril <sinjihng@gmail.com>
2021-10-20 10:19:42 +09:00
Jim Fasarakis-Hilliard
850187f246 Merge pull request #3343 from ChJR/feature/relocate_length
Relocate vm.obj_len to obj.length
2021-10-19 22:05:03 +03:00