|
1 |
| -commit 121a88e014aba626f45c72baed02b32c7b125f07 |
| 1 | +commit a889953c08d33854e574ab06e9593e0484c4c147 |
2 | 2 | Author: stepan < [email protected]>
|
3 | 3 | Date: Wed Jul 9 18:50:37 2025 +0200
|
4 | 4 |
|
@@ -683,7 +683,7 @@ index 4f1c76b..3d2c7e9 100644
|
683 | 683 | }
|
684 | 684 | }
|
685 | 685 | diff --git a/src/str/pyunicode_new.rs b/src/str/pyunicode_new.rs
|
686 |
| -index 7b1c2df..0f21024 100644 |
| 686 | +index 7b1c2df..5ac8dec 100644 |
687 | 687 | --- a/src/str/pyunicode_new.rs
|
688 | 688 | +++ b/src/str/pyunicode_new.rs
|
689 | 689 | @@ -1,75 +1,30 @@
|
@@ -765,14 +765,32 @@ index 7b1c2df..0f21024 100644
|
765 | 765 | - core::ptr::write(data_ptr, 0);
|
766 | 766 | - validate_str!(ptr);
|
767 | 767 | - ptr.cast::<PyObject>()
|
768 |
| -+ PyUnicode_FromStringAndSize(buf.as_ptr() as *const i8, usize_to_isize(num_chars)) |
| 768 | ++ PyUnicode_FromStringAndSize(buf.as_ptr() as *const i8, usize_to_isize(buf.len())) |
769 | 769 | }
|
770 | 770 | }
|
771 | 771 | diff --git a/src/str/scalar.rs b/src/str/scalar.rs
|
772 |
| -index 12adb63..c8e6a2e 100644 |
| 772 | +index 12adb63..99fce8f 100644 |
773 | 773 | --- a/src/str/scalar.rs
|
774 | 774 | +++ b/src/str/scalar.rs
|
775 |
| -@@ -40,7 +40,9 @@ pub fn str_impl_kind_scalar(buf: &str) -> *mut pyo3_ffi::PyObject { |
| 775 | +@@ -1,11 +1,17 @@ |
| 776 | + // SPDX-License-Identifier: (Apache-2.0 OR MIT) |
| 777 | + |
| 778 | ++use pyo3_ffi::PyUnicode_FromStringAndSize; |
| 779 | + use crate::str::pyunicode_new::{ |
| 780 | + pyunicode_ascii, pyunicode_fourbyte, pyunicode_onebyte, pyunicode_twobyte, |
| 781 | + }; |
| 782 | ++use crate::util::usize_to_isize; |
| 783 | + |
| 784 | + #[inline(never)] |
| 785 | + pub fn str_impl_kind_scalar(buf: &str) -> *mut pyo3_ffi::PyObject { |
| 786 | ++ // all the optimizations below don't make sense for GraalPy |
| 787 | ++ return unsafe { |
| 788 | ++ PyUnicode_FromStringAndSize(buf.as_ptr() as *const i8, usize_to_isize(buf.len())) |
| 789 | ++ }; |
| 790 | + let num_chars = bytecount::num_chars(buf.as_bytes()); |
| 791 | + if buf.len() == num_chars { |
| 792 | + return pyunicode_ascii(buf.as_ptr(), num_chars); |
| 793 | +@@ -40,7 +46,9 @@ pub fn str_impl_kind_scalar(buf: &str) -> *mut pyo3_ffi::PyObject { |
776 | 794 | #[inline(always)]
|
777 | 795 | pub fn unicode_from_str(buf: &str) -> *mut pyo3_ffi::PyObject {
|
778 | 796 | if unlikely!(buf.is_empty()) {
|
|
0 commit comments