Commit Graph

1645 Commits

Author SHA1 Message Date
Noah
dffdef4c85 Merge pull request #1792 from youknowone/struct
Fix struct module and add test from unittest
2020-03-05 23:17:56 -06:00
Jeong YunWon
c150a43441 Merge pull request #1778 from youknowone/int-indexable-base
non-int indexable base for int()
2020-03-05 01:25:03 +09:00
Jeong YunWon
1c6808748e Fix struct pack and unpack 2020-03-04 11:42:17 +09:00
Noah
7f7cad3998 Merge pull request #1790 from RustPython/coolreader18/pydoc
Add pydoc stdlib module
2020-03-02 07:16:27 -06:00
coolreader18
43713c41e4 Add gi_ and cr_ attributes to generators and coroutines 2020-03-01 23:11:28 -06:00
coolreader18
48de33cbbd Move generator functionality to objcoroinner 2020-03-01 23:11:28 -06:00
Noah
428cd6aaf7 Add frame.{f_back,f_lineno} 2020-03-01 15:55:28 -06:00
Noah
c703bb72d0 Correct module.__dir__ 2020-03-01 14:57:10 -06:00
Noah
d3343b6de4 Add vm.new_runtime_error 2020-02-29 12:02:36 -06:00
Idan Dor
6ea5d58f24 Fix previous merge of objtype.rs.
Moved the tests to their more correct place of `tests/snippets/class.py`.
2020-02-29 16:34:14 +02:00
Idan Dor
23e0467876 Merge remote-tracking branch 'remotes/upstream/master' into feature/mro_resolution
# Conflicts:
#	vm/src/obj/objsuper.rs
#	vm/src/obj/objtype.rs
2020-02-29 13:17:33 +02:00
Aviv Palivoda
e07ca66db4 Merge pull request #1772 from palaviv/set-fixes
Set fixes
2020-02-29 12:53:16 +02:00
Aviv Palivoda
69ba6cf887 Rename hash_iter_no_order to hash_iter_unordered 2020-02-29 09:40:16 +02:00
Noah
7be93a96da Merge pull request #1766 from RustPython/coolreader18/stdlib-typing
Add the typing standard library module, rework tp_new
2020-02-28 22:50:07 -06:00
Jeong YunWon
4be3a365ce non-int indexable base for int() 2020-02-29 10:07:14 +09:00
Idan Dor
cb24114444 Fixed clippy suggestion. 2020-02-22 16:43:00 +02:00
Idan Dor
8b80707cf8 Fixes according to PR review and added tests:
Moved mro creation from super getattribute to super constructor.

Removed optional VM argument in new class construction and changed the function to return String which is later "unwrapped" if a vm is available.

Added the relevant tests to `types_snippet.py`.
2020-02-22 16:10:49 +02:00
Aviv Palivoda
3db197c4b1 Fix set intersection_update 2020-02-22 12:59:48 +02:00
Aviv Palivoda
84250294b0 Fix frozenset hash 2020-02-22 12:36:27 +02:00
Aviv Palivoda
be9d8a4a56 Fix symmetric_difference 2020-02-22 11:22:01 +02:00
Aviv Palivoda
f21e35c31a Merge pull request #1771 from palaviv/set-tests
Add CPython Set tests and support Args in methods
2020-02-22 10:01:02 +02:00
Noah
82d683730c Misc changes 2020-02-20 23:53:19 -06:00
Jeong YunWon
9bbdbb6b3b Remove test warnings 2020-02-18 08:14:48 +00:00
Noah
c8c32006a5 Fix clippy lints 2020-02-16 17:51:37 -06:00
Noah
c5e856a34d Rework super() 2020-02-16 16:28:28 -06:00
Noah
301e565f58 Rework tp_new 2020-02-16 16:05:11 -06:00
Noah
0f03b794f8 Add ctx.new_staticmethod 2020-02-16 16:02:43 -06:00
Noah
e27fa254fa Improve PyClassRef::iter_mro() 2020-02-16 16:02:43 -06:00
Noah
03c2042bd8 Add generic_getattribute{,_opt} 2020-02-16 16:02:26 -06:00
Aviv Palivoda
34d8c44952 Support Args in set/frozenset methods 2020-02-16 20:32:50 +02:00
Idan Dor
1e985e26da Fixed issue MRO computation in RustPython doesn't seem to implement C3 correctly #1659.
To my surprise the C3 algorithm was implemented, however I have found a few problems which cause it to appear like it isn't:
- Bad mro usage in super: starting from the current class mro instead of the original class at the index of the current class. This leads to skipping classes gotten from multiple inheritance.
- A minor error in mro c3 implementation - not keeping local precedence ordering.
- The mro c3 implementation also allowed duplicate base classes. (Not from the issue but I noticed this anyway).

To allow the fix in new class creation I added an optional vm argument.
This allows the class creation to correctly throw type errors at mro errors.
Due to classes being necessary to vm creation in the first place, this argument is optional (and should only be skipped during initial type creation) and if there is an error here, it will panic instead of returning it.
2020-02-14 15:08:47 +02:00
Do Nhat Minh
0c731e8a9b Add as_integer_ratio to PyInt 2020-02-11 16:01:22 -05:00
Do Nhat Minh
914454e4ba Add __pos__ to PyComplex 2020-02-10 11:23:50 -05:00
Jeong YunWon
8d7be94b03 PyBool 2020-02-07 11:56:31 +09:00
Jeong YunWon
6ddb690e09 Remove _vm parameter when it is not required 2020-02-06 11:07:51 +09:00
Jeong YunWon
c0b235ed66 cleanup property and get descriptor codes 2020-02-06 03:56:40 +09:00
Jeong YunWon
58744df1d5 Revert 08e66b5002
which is not required anymore
2020-02-06 03:56:40 +09:00
Jeong YunWon
facabfee1a Remove PropertyBuilder and add new_getset 2020-02-06 03:45:19 +09:00
Jeong YunWon
0aee78de18 pyproperty generates PyGetSet instead of PyProperty 2020-02-06 03:42:05 +09:00
Jeong YunWon
23381b9937 compatiibility for CPytthon descr_check 2020-02-06 03:42:01 +09:00
Jeong YunWon
226a2a6cb9 VM polymorphism for getter and setter 2020-02-06 03:36:05 +09:00
Jeong YunWon
d1f9cb4e58 PySetResult and IntoPySetResult 2020-02-06 03:33:34 +09:00
Jeong YunWon
ca557788c8 &self support for getter/setter 2020-02-06 01:47:53 +09:00
Jeong YunWon
c3d5f6c145 IntoPyGetterFunc, IntoPySetterFunc 2020-02-06 01:46:00 +09:00
Jeong YunWon
9f5cd17f2b Add getset_descriptor 2020-02-06 01:23:39 +09:00
Jeong YunWon
7d0d313aa5 &str::to_string -> &str::to_owned for variables 2020-02-05 22:55:34 +09:00
Jeong YunWon
1bac582921 &str::to_string -> &str::to_owned for literals 2020-02-05 22:55:33 +09:00
Noah
3595f4e1a4 Merge pull request #1730 from youknowone/type-error
Fix type() error message and BaseException.__str__
2020-02-03 19:28:25 -06:00
Jeong YunWon
3e56b3f284 PyBaseObject 2020-02-01 16:56:12 +09:00
Jeong YunWon
c366c2074c Fix type() error message and BaseException.__str__ 2020-02-01 13:23:32 +09:00