Skip to content

Commit bf2f4de

Browse files
authored
Fix tests
1 parent c624693 commit bf2f4de

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

Python/codecs.c

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -731,11 +731,11 @@ codec_handler_write_unicode_hex(Py_UCS1 **p, Py_UCS4 ch)
731731

732732

733733
static inline void
734-
codec_handler_unicode_log10_max(Py_UCS4 ch, uint64_t *base, uint64_t *digits)
734+
codec_handler_unicode_log10_max(Py_UCS4 ch, int *base, int *digits)
735735
{
736736
#define MAKE_BRANCH(D, N) \
737737
do { \
738-
if (ch < (N)) { \
738+
if (ch < 10 * (N)) { \
739739
if (base != NULL) { \
740740
*base = (N); \
741741
} \
@@ -745,13 +745,13 @@ codec_handler_unicode_log10_max(Py_UCS4 ch, uint64_t *base, uint64_t *digits)
745745
return; \
746746
} \
747747
} while (0)
748-
MAKE_BRANCH(1, 10);
749-
MAKE_BRANCH(2, 100);
750-
MAKE_BRANCH(3, 1000);
751-
MAKE_BRANCH(4, 10000);
752-
MAKE_BRANCH(5, 100000);
753-
MAKE_BRANCH(6, 1000000);
754-
MAKE_BRANCH(7, 10000000);
748+
MAKE_BRANCH(1, 1);
749+
MAKE_BRANCH(2, 10);
750+
MAKE_BRANCH(3, 100);
751+
MAKE_BRANCH(4, 1000);
752+
MAKE_BRANCH(5, 10000);
753+
MAKE_BRANCH(6, 100000);
754+
MAKE_BRANCH(7, 1000000);
755755
#undef MAKE_BRANCH
756756
Py_UNREACHABLE();
757757
}
@@ -764,7 +764,7 @@ codec_handler_unicode_log10_max(Py_UCS4 ch, uint64_t *base, uint64_t *digits)
764764
static inline void
765765
codec_handler_write_unicode_dec(Py_UCS1 **p, Py_UCS4 ch)
766766
{
767-
uint64_t base = 0, digits = 0;
767+
int base = 0, digits = 0;
768768
codec_handler_unicode_log10_max(ch, &base, &digits);
769769
assert(base != 0 && digits != 0);
770770
assert(digits <= 7);
@@ -910,7 +910,7 @@ PyObject *PyCodec_XMLCharRefReplaceErrors(PyObject *exc)
910910
for (Py_ssize_t i = start; i < end; ++i) {
911911
/* object is guaranteed to be "ready" */
912912
Py_UCS4 ch = PyUnicode_READ_CHAR(obj, i);
913-
uint64_t k = 0;
913+
int k = 0;
914914
codec_handler_unicode_log10_max(ch, NULL, &k);
915915
assert(k != 0);
916916
assert(k <= 7);

0 commit comments

Comments
 (0)