Mercurial > hg
comparison mercurial/cext/charencode.c @ 48811:92c430e7e37a
cext: drop preprocessor PyInt aliases
Now that we dropped support for Python 2 we can use the Python 3 native
functions.
Differential Revision: https://phab.mercurial-scm.org/D12222
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Sun, 20 Feb 2022 15:42:47 -0700 |
parents | 83f0e93ec34b |
children | b0dd39b91e7a |
comparison
equal
deleted
inserted
replaced
48810:ed03fffaac30 | 48811:92c430e7e37a |
---|---|
12 #include <assert.h> | 12 #include <assert.h> |
13 | 13 |
14 #include "charencode.h" | 14 #include "charencode.h" |
15 #include "compat.h" | 15 #include "compat.h" |
16 #include "util.h" | 16 #include "util.h" |
17 | |
18 #ifdef IS_PY3K | |
19 /* The mapping of Python types is meant to be temporary to get Python | |
20 * 3 to compile. We should remove this once Python 3 support is fully | |
21 * supported and proper types are used in the extensions themselves. */ | |
22 #define PyInt_Type PyLong_Type | |
23 #define PyInt_AS_LONG PyLong_AS_LONG | |
24 #endif | |
25 | 17 |
26 /* clang-format off */ | 18 /* clang-format off */ |
27 static const char lowertable[128] = { | 19 static const char lowertable[128] = { |
28 '\x00', '\x01', '\x02', '\x03', '\x04', '\x05', '\x06', '\x07', | 20 '\x00', '\x01', '\x02', '\x03', '\x04', '\x05', '\x06', '\x07', |
29 '\x08', '\x09', '\x0a', '\x0b', '\x0c', '\x0d', '\x0e', '\x0f', | 21 '\x08', '\x09', '\x0a', '\x0b', '\x0c', '\x0d', '\x0e', '\x0f', |
226 dirstateItemObject *tuple; | 218 dirstateItemObject *tuple; |
227 Py_ssize_t pos = 0; | 219 Py_ssize_t pos = 0; |
228 const char *table; | 220 const char *table; |
229 | 221 |
230 if (!PyArg_ParseTuple(args, "O!O!O!:make_file_foldmap", &PyDict_Type, | 222 if (!PyArg_ParseTuple(args, "O!O!O!:make_file_foldmap", &PyDict_Type, |
231 &dmap, &PyInt_Type, &spec_obj, &PyFunction_Type, | 223 &dmap, &PyLong_Type, &spec_obj, &PyFunction_Type, |
232 &normcase_fallback)) { | 224 &normcase_fallback)) { |
233 goto quit; | 225 goto quit; |
234 } | 226 } |
235 | 227 |
236 spec = (int)PyInt_AS_LONG(spec_obj); | 228 spec = (int)PyLong_AS_LONG(spec_obj); |
237 switch (spec) { | 229 switch (spec) { |
238 case NORMCASE_LOWER: | 230 case NORMCASE_LOWER: |
239 table = lowertable; | 231 table = lowertable; |
240 break; | 232 break; |
241 case NORMCASE_UPPER: | 233 case NORMCASE_UPPER: |