Commit Graph

1125 Commits

Author SHA1 Message Date
coolreader18
b74b65d37e Make CodeObject.source_path an Option<String> 2019-06-16 19:59:04 -05:00
Aviv Palivoda
60e799727f Support reversed on sequence 2019-06-14 15:25:24 +03:00
Windel Bouwman
3f343aff6c Merge pull request #1018 from palaviv/imp3
Importlib
2019-06-12 16:21:26 +02:00
coolreader18
cb2fe657a9 Merge pull request #1014 from mkurnikov/cleanup-get-method-error-handling
Cleanup get_method() error handling
2019-06-11 17:43:58 -05:00
Aviv Palivoda
ea8e28026b Simplify objmodule 2019-06-11 13:13:32 +03:00
Aviv Palivoda
c8248c3211 Expose __name__ in __dict__ 2019-06-10 19:18:32 +03:00
Aviv Palivoda
375790e142 objmodule should have a dict 2019-06-10 19:18:32 +03:00
Aviv Palivoda
fe0284aa05 Add new to objmodule and change __name__ to property 2019-06-10 19:18:32 +03:00
Aviv Palivoda
698044b128 Add Module.__name__ 2019-06-10 19:18:32 +03:00
coolreader18
740e8387b8 Merge pull request #1027 from alanjds/format-bang
Feature: str.format accepting !r, !s and !a
2019-06-10 10:56:00 -05:00
Alan Justino
f0a2b4c50b Apply the {!r} on str.format calls
By the Python docs, the `!` forces a conversion of the argument before
applying the normal formating logic described after the `:` marker.

See: https://docs.python.org/3.4/library/string.html#format-string-syntax
2019-06-09 18:11:10 -03:00
Antonio Yang
f76be43d26 str.isprintable
- check unicode type by unicode_categories
- rm redundant check of empty string
2019-06-09 23:33:38 +08:00
Maxim Kurnikov
8a5182a8a1 make get_method_or_type_error() error message lazy 2019-06-07 16:08:37 +03:00
Michel Heily
b2cdeab0c6 Fix memoryview.obj misimplementation.
The memoryview skeleton did not correctly assign the "obj" attribute;
The "obj" attribute was assigned to the memoryview class and not the memryview object,
leading to a funny bug that can be reproduced as follows:

```python

m1 = memoryview(b'1234')
m2 = memoryview(b'abcd')

print(m1.obj)
```

the result would be the value inside `m2` instead that of `m1`
2019-06-05 02:36:45 +03:00
Maxim Kurnikov
3bfd66bb89 make some exception messages more compatible with CPython, split get_method() into two methods and make raising TypeError more explicit for get_method() errors 2019-06-03 19:46:32 +03:00
Maxim Kurnikov
3b5cc1ad2f more doc comments, split with_exit() method for context manager __exit__ into two methods 2019-06-02 01:37:25 +03:00
Maxim Kurnikov
bc35a64e54 fix most of clippy warnings 2019-06-01 03:19:22 +03:00
ben
d2757a2680 Fix merge issue with PyTuple::fast_getitem 2019-05-30 21:22:30 +12:00
ben
c0c531d550 Merge branch 'master' into sys_flags
# Conflicts:
#	tests/snippets/sysmod.py
#	vm/src/sysmodule.rs
2019-05-30 21:12:57 +12:00
Windel Bouwman
22b4894ae6 Merge pull request #1006 from RustPython/coolreader18/weakproxy-setattr
Add __setattr__ to weakproxy
2019-05-30 09:47:01 +02:00
coolreader18
725a1e8434 Merge pull request #979 from youknowone/refactor-set
PySet/PyFrozenSet refactoring
2019-05-29 23:38:56 -05:00
coolreader18
1dc2d09713 Add __setattr__ to weakproxy 2019-05-29 22:46:12 -05:00
Windel Bouwman
121cd43932 Merge pull request #901 from youknowone/str-encode
Add str.encode for utf-8
2019-05-29 15:20:36 +02:00
Jeong YunWon
c349f77207 Add {set,frozenset}.__r*__ 2019-05-29 21:51:20 +09:00
Jeong YunWon
ba4ac902eb PySet/PyFrozenSet doesn't call PyObject::new 2019-05-29 21:51:20 +09:00
Jeong YunWon
979e1253ae Fix set/frozenset comparison 2019-05-29 21:51:20 +09:00
Jeong YunWon
31c88721e6 Refactor PySet with try_set_inner! 2019-05-29 21:51:20 +09:00
Jeong YunWon
89729c3155 PyClassImpl for PySet, PyFrozenSet 2019-05-29 21:51:20 +09:00
coolreader18
5bd36ad9c5 Merge pull request #927 from youknowone/set-collision
Fix set() hash collision
2019-05-29 07:44:31 -05:00
Jeong YunWon
59476c65bb PyBytes::from_string 2019-05-29 21:27:58 +09:00
Jeong YunWon
7f2560c9e1 Add str.encode for utf-8 2019-05-29 21:25:34 +09:00
jgirardet
ad357d08af normalize_encoding 2019-05-29 21:24:51 +09:00
rbrtberglund
eed9c44a74 improved PyByteInner.setitem 2019-05-29 00:02:58 +02:00
rbrtberglund
7be801db2f implemented __setitem__ for bytearray 2019-05-27 22:22:20 +02:00
ZapAnton
a2e64c0425 objstr: Replaced the unwrap_or with the OverflowError 2019-05-25 16:38:51 +03:00
ZapAnton
e38c54985e objstr: Replaced the if-else construct with the max function 2019-05-24 20:37:47 +03:00
ZapAnton
fedbd29051 objstr: Refactored the 'mul' method
- Used `str::repeat` instead of manually building the result string
- Rewritten the int type check to return error at the beginning of the
method
- Replaced the `unwrap` calls with the single `unwrap_or`
2019-05-24 13:01:15 +03:00
Seo Sanghyeon
433434a1bb Fix rsplit 2019-05-21 23:01:04 +09:00
Windel Bouwman
c01a867da5 Merge pull request #974 from stwen77/add_int_to_bytes
Add to_bytes for int
2019-05-21 14:47:31 +02:00
Yonatan Goldschmidt
84684e5f7d Don't use RefCell in tuple object 2019-05-19 23:57:32 +03:00
Yonatan Goldschmidt
802f07980e Remove tuple handling from get_elements_cell
Like my HEAD, this shouldn't be allowed for a tuple (and the
only call-site of this function doesn't run on tuples anyway).
2019-05-19 23:01:10 +03:00
Yonatan Goldschmidt
9ad527c800 Remove tuple handling from get_mut_elements
This function is unused anyway; But even was it used, it makes no sense
to return mutable references to tuple items, when the tuple holding them
is immutable.
2019-05-19 23:01:05 +03:00
Ben Lewis
964256439b Update vm/src/obj/objnamespace.rs
Co-Authored-By: coolreader18 <33094578+coolreader18@users.noreply.github.com>
2019-05-19 15:25:52 +12:00
ben
60c9d5004a Add SimpleNamespace and sys.implementation 2019-05-19 15:01:22 +12:00
ben
2ca96c8ae1 Add sys.flags by creating a pystruct_sequence macro 2019-05-19 10:17:21 +12:00
coolreader18
8359c6e031 Merge pull request #983 from ypyf/type_new
improve error message for type_new
2019-05-18 17:12:43 -05:00
coolreader18
9888d27e61 Merge pull request #981 from youknowone/frexp
Add math.frexp
2019-05-16 21:37:34 -05:00
coolreader18
23344ddf8a Merge pull request #982 from youknowone/float-fromhex
Add float.fromhex float.hex
2019-05-16 21:33:40 -05:00
Jeong YunWon
ca912a168d Add float.to_hex 2019-05-17 03:24:31 +09:00
Jeong YunWon
ceca2ed98e Add float.fromhex 2019-05-17 02:35:39 +09:00