Commit Graph

128 Commits

Author SHA1 Message Date
yt2b
980e578d27 Remove map_err 2023-01-04 23:36:34 +09:00
yt2b
a79d3ad61b Fix functions 2023-01-04 23:08:20 +09:00
yt2b
555987e97f Fix functions 2023-01-03 16:22:27 +09:00
yt2b
b9e2b716dd Add function 2023-01-03 16:10:35 +09:00
yt2b
e11cda970a Implement From trait 2023-01-03 16:08:41 +09:00
yt2b
8e85234134 Fix format_int 2023-01-02 22:51:49 +09:00
Jeong YunWon
23c7b92aff Move (c)format basic implementations to rustpython-common 2023-01-02 20:21:36 +09:00
Padraic Fanning
50fd23ab47 Fix unnecessary closure (clippy) 2022-09-22 23:09:30 -04:00
Jeong Yunwon
7b959dfba7 relocate conversion traits and fix build 2022-08-21 23:18:25 +09:00
Jeong YunWon
27040c01b0 Fix nightly clippy 2022-08-16 09:02:42 +09:00
Jeong YunWon
2fafd409a9 impl _imp.source_hash 2022-08-15 16:09:32 +09:00
Gilteun Choi
13acb1ce6e Precision bug fix when FormatType is None (#3975) 2022-08-04 22:34:31 +09:00
Gyubong Lee
d7f17d82ec Fix formatter 2022-07-27 13:37:34 +09:00
Gyubong Lee
60c4db78dd Reflect feedbacks 2022-07-27 13:36:15 +09:00
Gyubong Lee
187fc5d872 hash_pointer -> hash_object_id 2022-07-26 11:42:25 +09:00
Gyubong Lee
01a5fa1ba9 Reflect feedback 2022-07-25 18:07:10 +09:00
Gyubong Lee
dc3c7a9712 Fix lint 2022-07-25 18:07:10 +09:00
Gyubong Lee
d317c8b08c Move hash_complex implementation from hash.rs to complex.rs 2022-07-25 18:07:10 +09:00
Gyubong Lee
6098eb66ed Fix wrong implementation of hash_complex 2022-07-25 18:07:10 +09:00
Gyubong Lee
3c0f3cacdd Apply inlining 2022-07-25 18:07:10 +09:00
Gyubong Lee
d388a13120 Fix hash_complex's hash function 2022-07-25 18:07:10 +09:00
Gyubong Lee
8a97c0b8fa libc::c_void -> std::ffi::c_void 2022-07-25 18:07:10 +09:00
Gyubong Lee
98d3f38476 Reflect feedbacks 2022-07-25 18:07:10 +09:00
Jeong Yunwon
dd2bf4c96b fix clippy 2022-07-21 06:45:28 +09:00
Jeong Yunwon
8c0be4b48f Fix nightly clippy warnings 2022-06-24 01:13:32 +09:00
Jeong Yunwon
7105073c91 shared hash seed in process 2022-05-23 09:03:13 +09:00
Jeong Yunwon
370b2b3f99 static object 2022-05-22 14:18:34 +09:00
Jeong Yunwon
cbeeb51cee Fix lcg_random overflow 2022-05-17 05:53:42 +09:00
Jeong Yunwon
c9f1f61bae fix clippy warnings 2022-05-07 20:00:57 +09:00
Noa
77495a2b2d Move stdlib::os::errno to common 2022-04-30 13:35:43 -05:00
Noa
b382d3c9e3 Move crt_fd to common 2022-04-30 13:35:42 -05:00
Jeong Yunwon
82eb352e9f common::rc::PyWeak is not used and confusing by its name 2022-04-23 05:17:35 +09:00
Jeong Yunwon
6357a1acbe clean up imports and useless allow attributes 2022-04-15 23:58:20 +09:00
Padraic Fanning
29048b105e Fix needless_late_init Clippy warning 2022-02-25 19:33:52 -05:00
Noa
1188369956 Fix clippy warnings with 1.58 & convert some format strings to capture-args 2022-01-13 23:53:25 -06:00
Noa
af7ec416f9 Prevent edge case race condition, hopefully 2021-11-15 16:08:47 -06:00
Noa
8c7def00ec Address review 2021-11-15 16:08:47 -06:00
Noa
1da239ac08 Fix clippy 2021-11-15 16:08:47 -06:00
Noa
c6871166d1 Make WeakListInner a sidetable 2021-11-15 16:08:47 -06:00
Noa
65cde9a0d6 Optimize size of WeakRefList
The outer struct is only 1 word now, and inside the box it's a byte for
the mutex (which gets padded to a word) + a word for the linked list (we
don't use the tail) + a word for the pointer to the object.
2021-11-15 16:08:46 -06:00
Noa
e42a3ca48e Big overhaul part 1 - replace PyRc with manual RefCount + WeakRefList 2021-11-15 16:08:45 -06: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
Noa
358ce09b5c Run cargo upgrade 2021-10-30 19:42:35 -05:00
Noa
09e9ea91e7 TryFrom, TryInto, FromIterator are in prelude now 2021-10-21 17:04:19 -05: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
Noa
27540e1d35 Add unparse feature to ast 2021-10-17 21:55:27 -05:00
Jeong YunWon
a42d547a3f new_{utf8_str, ascii_literal} -> new_str again 2021-10-11 21:28:14 +09:00
snowapril
945d330b9c impl fmt::Display for BorrowedValue<str>
Signed-off-by: snowapril <sinjihng@gmail.com>
2021-10-10 15:38:45 +09:00
Jeong YunWon
2eb6c6826e Merge pull request #3046 from fanninpm/latin-1-encoding
Implement latin_1 in Rust
2021-10-01 21:38:38 +09:00
Jeong YunWon
44f7bc468a vm::utils::ascii! -> common::ascii! 2021-09-28 15:47:54 +09:00