Skip to content

Commit 09e7071

Browse files
committed
Fix: MSVC compatibility
1 parent 950f33d commit 09e7071

File tree

1 file changed

+33
-33
lines changed

1 file changed

+33
-33
lines changed

python/lib.c

Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -662,7 +662,7 @@ static PyObject *Str_repr(Str *self) {
662662

663663
static Py_hash_t Str_hash(Str *self) { return (Py_hash_t)sz_hash(self->memory.start, self->memory.length); }
664664

665-
static char const *const doc_like_hash = //
665+
static char const doc_like_hash[] = //
666666
"Compute the hash value of the string.\n\n"
667667
"This function can be called as a method on a Str object or as a standalone function.\n\n"
668668
"Args:\n"
@@ -1204,7 +1204,7 @@ static PyObject *Strs_richcompare(PyObject *self, PyObject *other, int op) {
12041204
}
12051205
}
12061206

1207-
static char const *const doc_decode = //
1207+
static char const doc_decode[] = //
12081208
"Decode the bytes into a Unicode string with a given encoding.\n\n"
12091209
"Args:\n"
12101210
" self (Str or str or bytes): The string object.\n"
@@ -1257,7 +1257,7 @@ static PyObject *Str_decode(PyObject *self, PyObject *args, PyObject *kwargs) {
12571257
return PyUnicode_Decode(text.start, text.length, encoding.start, errors.start);
12581258
}
12591259

1260-
static char const *const doc_write_to = //
1260+
static char const doc_write_to[] = //
12611261
"Write the string to a file.\n\n"
12621262
"Args:\n"
12631263
" self (Str or str or bytes): The string object.\n"
@@ -1335,7 +1335,7 @@ static PyObject *Str_write_to(PyObject *self, PyObject *args, PyObject *kwargs)
13351335
Py_RETURN_NONE;
13361336
}
13371337

1338-
static char const *const doc_offset_within = //
1338+
static char const doc_offset_within[] = //
13391339
"Return the raw byte offset of this StringZilla string within a larger StringZilla string.\n\n"
13401340
"Args:\n"
13411341
" self (Str or str or bytes): The substring.\n"
@@ -1468,7 +1468,7 @@ static int _Str_find_implementation_( //
14681468
return 1;
14691469
}
14701470

1471-
static char const *const doc_contains = //
1471+
static char const doc_contains[] = //
14721472
"Check if a string contains a substring.\n\n"
14731473
"Args:\n"
14741474
" self (Str or str or bytes): The string object.\n"
@@ -1488,7 +1488,7 @@ static PyObject *Str_contains(PyObject *self, PyObject *args, PyObject *kwargs)
14881488
else { Py_RETURN_TRUE; }
14891489
}
14901490

1491-
static char const *const doc_find = //
1491+
static char const doc_find[] = //
14921492
"Find the first occurrence of a substring.\n\n"
14931493
"Args:\n"
14941494
" self (Str or str or bytes): The string object.\n"
@@ -1507,7 +1507,7 @@ static PyObject *Str_find(PyObject *self, PyObject *args, PyObject *kwargs) {
15071507
return PyLong_FromSsize_t(signed_offset);
15081508
}
15091509

1510-
static char const *const doc_index = //
1510+
static char const doc_index[] = //
15111511
"Find the first occurrence of a substring or raise an error if not found.\n\n"
15121512
"Args:\n"
15131513
" self (Str or str or bytes): The string object.\n"
@@ -1532,7 +1532,7 @@ static PyObject *Str_index(PyObject *self, PyObject *args, PyObject *kwargs) {
15321532
return PyLong_FromSsize_t(signed_offset);
15331533
}
15341534

1535-
static char const *const doc_rfind = //
1535+
static char const doc_rfind[] = //
15361536
"Find the last occurrence of a substring.\n\n"
15371537
"Args:\n"
15381538
" self (Str or str or bytes): The string object.\n"
@@ -1551,7 +1551,7 @@ static PyObject *Str_rfind(PyObject *self, PyObject *args, PyObject *kwargs) {
15511551
return PyLong_FromSsize_t(signed_offset);
15521552
}
15531553

1554-
static char const *const doc_rindex = //
1554+
static char const doc_rindex[] = //
15551555
"Find the last occurrence of a substring or raise an error if not found.\n\n"
15561556
"Args:\n"
15571557
" self (Str or str or bytes): The string object.\n"
@@ -1631,7 +1631,7 @@ static PyObject *_Str_partition_implementation(PyObject *self, PyObject *args, P
16311631
return result_tuple;
16321632
}
16331633

1634-
static char const *const doc_partition = //
1634+
static char const doc_partition[] = //
16351635
"Split the string into a 3-tuple around the first occurrence of a separator.\n\n"
16361636
"Args:\n"
16371637
" self (Str or str or bytes): The string object.\n"
@@ -1643,7 +1643,7 @@ static PyObject *Str_partition(PyObject *self, PyObject *args, PyObject *kwargs)
16431643
return _Str_partition_implementation(self, args, kwargs, &sz_find, sz_false_k);
16441644
}
16451645

1646-
static char const *const doc_rpartition = //
1646+
static char const doc_rpartition[] = //
16471647
"Split the string into a 3-tuple around the last occurrence of a separator.\n\n"
16481648
"Args:\n"
16491649
" self (Str or str or bytes): The string object.\n"
@@ -1655,7 +1655,7 @@ static PyObject *Str_rpartition(PyObject *self, PyObject *args, PyObject *kwargs
16551655
return _Str_partition_implementation(self, args, kwargs, &sz_rfind, sz_true_k);
16561656
}
16571657

1658-
static char const *const doc_count = //
1658+
static char const doc_count[] = //
16591659
"Count the occurrences of a substring.\n\n"
16601660
"Args:\n"
16611661
" self (Str or str or bytes): The string object.\n"
@@ -1790,7 +1790,7 @@ static PyObject *_Str_edit_distance(PyObject *self, PyObject *args, PyObject *kw
17901790
return PyLong_FromSize_t(distance);
17911791
}
17921792

1793-
static char const *const doc_edit_distance = //
1793+
static char const doc_edit_distance[] = //
17941794
"Compute the Levenshtein edit distance between two strings.\n\n"
17951795
"Args:\n"
17961796
" self (Str or str or bytes): The first string.\n"
@@ -1803,7 +1803,7 @@ static PyObject *Str_edit_distance(PyObject *self, PyObject *args, PyObject *kwa
18031803
return _Str_edit_distance(self, args, kwargs, &sz_edit_distance);
18041804
}
18051805

1806-
static char const *const doc_edit_distance_unicode = //
1806+
static char const doc_edit_distance_unicode[] = //
18071807
"Compute the Levenshtein edit distance between two Unicode strings.\n\n"
18081808
"Args:\n"
18091809
" self (Str or str or bytes): The first string.\n"
@@ -1866,7 +1866,7 @@ static PyObject *_Str_hamming_distance(PyObject *self, PyObject *args, PyObject
18661866
return PyLong_FromSize_t(distance);
18671867
}
18681868

1869-
static char const *const doc_hamming_distance = //
1869+
static char const doc_hamming_distance[] = //
18701870
"Compute the Hamming distance between two strings.\n\n"
18711871
"Args:\n"
18721872
" self (Str or str or bytes): The first string.\n"
@@ -1879,7 +1879,7 @@ static PyObject *Str_hamming_distance(PyObject *self, PyObject *args, PyObject *
18791879
return _Str_hamming_distance(self, args, kwargs, &sz_hamming_distance);
18801880
}
18811881

1882-
static char const *const doc_hamming_distance_unicode = //
1882+
static char const doc_hamming_distance_unicode[] = //
18831883
"Compute the Hamming distance between two Unicode strings.\n\n"
18841884
"Args:\n"
18851885
" self (Str or str or bytes): The first string.\n"
@@ -1892,7 +1892,7 @@ static PyObject *Str_hamming_distance_unicode(PyObject *self, PyObject *args, Py
18921892
return _Str_hamming_distance(self, args, kwargs, &sz_hamming_distance_utf8);
18931893
}
18941894

1895-
static char const *const doc_alignment_score = //
1895+
static char const doc_alignment_score[] = //
18961896
"Compute the Needleman-Wunsch alignment score between two strings.\n\n"
18971897
"Args:\n"
18981898
" self (Str or str or bytes): The first string.\n"
@@ -1999,7 +1999,7 @@ static PyObject *Str_alignment_score(PyObject *self, PyObject *args, PyObject *k
19991999
return PyLong_FromSsize_t(score);
20002000
}
20012001

2002-
static char const *const doc_startswith = //
2002+
static char const doc_startswith[] = //
20032003
"Check if a string starts with a given prefix.\n\n"
20042004
"Args:\n"
20052005
" self (Str or str or bytes): The string object.\n"
@@ -2052,7 +2052,7 @@ static PyObject *Str_startswith(PyObject *self, PyObject *args, PyObject *kwargs
20522052
else { Py_RETURN_FALSE; }
20532053
}
20542054

2055-
static char const *const doc_endswith = //
2055+
static char const doc_endswith[] = //
20562056
"Check if a string ends with a given suffix.\n\n"
20572057
"Args:\n"
20582058
" self (Str or str or bytes): The string object.\n"
@@ -2105,7 +2105,7 @@ static PyObject *Str_endswith(PyObject *self, PyObject *args, PyObject *kwargs)
21052105
else { Py_RETURN_FALSE; }
21062106
}
21072107

2108-
static char const *const doc_translate = //
2108+
static char const doc_translate[] = //
21092109
"Perform transformation of a string using a look-up table.\n\n"
21102110
"Args:\n"
21112111
" self (Str or str or bytes): The string object.\n"
@@ -2234,7 +2234,7 @@ static PyObject *Str_translate(PyObject *self, PyObject *args, PyObject *kwargs)
22342234
}
22352235
}
22362236

2237-
static char const *const doc_find_first_of = //
2237+
static char const doc_find_first_of[] = //
22382238
"Find the index of the first occurrence of any character from another string.\n\n"
22392239
"Args:\n"
22402240
" self (Str or str or bytes): The string object.\n"
@@ -2254,7 +2254,7 @@ static PyObject *Str_find_first_of(PyObject *self, PyObject *args, PyObject *kwa
22542254
return PyLong_FromSsize_t(signed_offset);
22552255
}
22562256

2257-
static char const *const doc_find_first_not_of = //
2257+
static char const doc_find_first_not_of[] = //
22582258
"Find the index of the first character not in another string.\n\n"
22592259
"Args:\n"
22602260
" self (Str or str or bytes): The string object.\n"
@@ -2274,7 +2274,7 @@ static PyObject *Str_find_first_not_of(PyObject *self, PyObject *args, PyObject
22742274
return PyLong_FromSsize_t(signed_offset);
22752275
}
22762276

2277-
static char const *const doc_find_last_of = //
2277+
static char const doc_find_last_of[] = //
22782278
"Find the index of the last occurrence of any character from another string.\n\n"
22792279
"Args:\n"
22802280
" self (Str or str or bytes): The string object.\n"
@@ -2294,7 +2294,7 @@ static PyObject *Str_find_last_of(PyObject *self, PyObject *args, PyObject *kwar
22942294
return PyLong_FromSsize_t(signed_offset);
22952295
}
22962296

2297-
static char const *const doc_find_last_not_of = //
2297+
static char const doc_find_last_not_of[] = //
22982298
"Find the index of the last character not in another string.\n\n"
22992299
"Args:\n"
23002300
" self (Str or str or bytes): The string object.\n"
@@ -2602,7 +2602,7 @@ static PyObject *Str_split_with_known_callback(PyObject *self, PyObject *args, P
26022602
: Str_rsplit_(text_object, text, separator, keepseparator, maxsplit, finder, match_length);
26032603
}
26042604

2605-
static char const *const doc_split = //
2605+
static char const doc_split[] = //
26062606
"Split a string by a separator.\n\n"
26072607
"Args:\n"
26082608
" self (Str or str or bytes): The string object.\n"
@@ -2618,7 +2618,7 @@ static PyObject *Str_split(PyObject *self, PyObject *args, PyObject *kwargs) {
26182618
return Str_split_with_known_callback(self, args, kwargs, &sz_find, 0, sz_false_k, sz_false_k);
26192619
}
26202620

2621-
static char const *const doc_rsplit = //
2621+
static char const doc_rsplit[] = //
26222622
"Split a string by a separator starting from the end.\n\n"
26232623
"Args:\n"
26242624
" self (Str or str or bytes): The string object.\n"
@@ -2634,7 +2634,7 @@ static PyObject *Str_rsplit(PyObject *self, PyObject *args, PyObject *kwargs) {
26342634
return Str_split_with_known_callback(self, args, kwargs, &sz_rfind, 0, sz_true_k, sz_false_k);
26352635
}
26362636

2637-
static char const *const doc_split_charset = //
2637+
static char const doc_split_charset[] = //
26382638
"Split a string by a set of character separators.\n\n"
26392639
"Args:\n"
26402640
" self (Str or str or bytes): The string object.\n"
@@ -2648,7 +2648,7 @@ static PyObject *Str_split_charset(PyObject *self, PyObject *args, PyObject *kwa
26482648
return Str_split_with_known_callback(self, args, kwargs, &sz_find_char_from, 1, sz_false_k, sz_false_k);
26492649
}
26502650

2651-
static char const *const doc_rsplit_charset = //
2651+
static char const doc_rsplit_charset[] = //
26522652
"Split a string by a set of character separators in reverse order.\n\n"
26532653
"Args:\n"
26542654
" self (Str or str or bytes): The string object.\n"
@@ -2662,7 +2662,7 @@ static PyObject *Str_rsplit_charset(PyObject *self, PyObject *args, PyObject *kw
26622662
return Str_split_with_known_callback(self, args, kwargs, &sz_rfind_char_from, 1, sz_true_k, sz_false_k);
26632663
}
26642664

2665-
static char const *const doc_split_iter = //
2665+
static char const doc_split_iter[] = //
26662666
"Create an iterator for splitting a string by a separator.\n\n"
26672667
"Args:\n"
26682668
" self (Str or str or bytes): The string object.\n"
@@ -2677,7 +2677,7 @@ static PyObject *Str_split_iter(PyObject *self, PyObject *args, PyObject *kwargs
26772677
return Str_split_with_known_callback(self, args, kwargs, &sz_find, 0, sz_false_k, sz_true_k);
26782678
}
26792679

2680-
static char const *const doc_rsplit_iter = //
2680+
static char const doc_rsplit_iter[] = //
26812681
"Create an iterator for splitting a string by a separator in reverse order.\n\n"
26822682
"Args:\n"
26832683
" self (Str or str or bytes): The string object.\n"
@@ -2692,7 +2692,7 @@ static PyObject *Str_rsplit_iter(PyObject *self, PyObject *args, PyObject *kwarg
26922692
return Str_split_with_known_callback(self, args, kwargs, &sz_rfind, 0, sz_true_k, sz_true_k);
26932693
}
26942694

2695-
static char const *const doc_split_charset_iter = //
2695+
static char const doc_split_charset_iter[] = //
26962696
"Create an iterator for splitting a string by a set of character separators.\n\n"
26972697
"Args:\n"
26982698
" self (Str or str or bytes): The string object.\n"
@@ -2705,7 +2705,7 @@ static PyObject *Str_split_charset_iter(PyObject *self, PyObject *args, PyObject
27052705
return Str_split_with_known_callback(self, args, kwargs, &sz_find_char_from, 1, sz_false_k, sz_true_k);
27062706
}
27072707

2708-
static char const *const doc_rsplit_charset_iter = //
2708+
static char const doc_rsplit_charset_iter[] = //
27092709
"Create an iterator for splitting a string by a set of character separators in reverse order.\n\n"
27102710
"Args:\n"
27112711
" self (Str or str or bytes): The string object.\n"
@@ -2718,7 +2718,7 @@ static PyObject *Str_rsplit_charset_iter(PyObject *self, PyObject *args, PyObjec
27182718
return Str_split_with_known_callback(self, args, kwargs, &sz_rfind_char_from, 1, sz_true_k, sz_true_k);
27192719
}
27202720

2721-
static char const *const doc_splitlines = //
2721+
static char const doc_splitlines[] = //
27222722
"Split a string by line breaks.\n\n"
27232723
"Args:\n"
27242724
" self (Str or str or bytes): The string object.\n"

0 commit comments

Comments
 (0)