Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit b9a0f91

Browse files
committed
Rename LONG_LONG to PY_LONG_LONG. Fixes #710285.
1 parent 043bbc7 commit b9a0f91

15 files changed

Lines changed: 87 additions & 85 deletions

File tree

Doc/api/utilities.tex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -496,7 +496,7 @@ \section{Parsing arguments and building values
496496
\item[\samp{l} (integer) {[long int]}]
497497
Convert a Python integer to a C \ctype{long int}.
498498

499-
\item[\samp{L} (integer) {[LONG_LONG]}]
499+
\item[\samp{L} (integer) {[PY_LONG_LONG]}]
500500
Convert a Python integer to a C \ctype{long long}. This format is
501501
only available on platforms that support \ctype{long long} (or
502502
\ctype{_int64} on Windows).

Include/longobject.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,10 @@ PyAPI_FUNC(PyObject *) PyLong_FromVoidPtr(void *);
3333
PyAPI_FUNC(void *) PyLong_AsVoidPtr(PyObject *);
3434

3535
#ifdef HAVE_LONG_LONG
36-
PyAPI_FUNC(PyObject *) PyLong_FromLongLong(LONG_LONG);
37-
PyAPI_FUNC(PyObject *) PyLong_FromUnsignedLongLong(unsigned LONG_LONG);
38-
PyAPI_FUNC(LONG_LONG) PyLong_AsLongLong(PyObject *);
39-
PyAPI_FUNC(unsigned LONG_LONG) PyLong_AsUnsignedLongLong(PyObject *);
36+
PyAPI_FUNC(PyObject *) PyLong_FromLongLong(PY_LONG_LONG);
37+
PyAPI_FUNC(PyObject *) PyLong_FromUnsignedLongLong(unsigned PY_LONG_LONG);
38+
PyAPI_FUNC(PY_LONG_LONG) PyLong_AsLongLong(PyObject *);
39+
PyAPI_FUNC(unsigned PY_LONG_LONG) PyLong_AsUnsignedLongLong(PyObject *);
4040
#endif /* HAVE_LONG_LONG */
4141

4242
PyAPI_FUNC(PyObject *) PyLong_FromString(char *, char **, int);

Include/pyport.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ Used in: Py_uintptr_t
2727
2828
HAVE_LONG_LONG
2929
Meaning: The compiler supports the C type "long long"
30-
Used in: LONG_LONG
30+
Used in: PY_LONG_LONG
3131
3232
**************************************************************************/
3333

@@ -55,8 +55,8 @@ Used in: LONG_LONG
5555
*/
5656

5757
#ifdef HAVE_LONG_LONG
58-
#ifndef LONG_LONG
59-
#define LONG_LONG long long
58+
#ifndef PY_LONG_LONG
59+
#define PY_LONG_LONG long long
6060
#endif
6161
#endif /* HAVE_LONG_LONG */
6262

@@ -78,8 +78,8 @@ typedef unsigned long Py_uintptr_t;
7878
typedef long Py_intptr_t;
7979

8080
#elif defined(HAVE_LONG_LONG) && (SIZEOF_VOID_P <= SIZEOF_LONG_LONG)
81-
typedef unsigned LONG_LONG Py_uintptr_t;
82-
typedef LONG_LONG Py_intptr_t;
81+
typedef unsigned PY_LONG_LONG Py_uintptr_t;
82+
typedef PY_LONG_LONG Py_intptr_t;
8383

8484
#else
8585
# error "Python needs a typedef for Py_uintptr_t in pyport.h."

Misc/NEWS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,8 @@ Build
101101
C API
102102
-----
103103

104+
- LONG_LONG was renamed to PY_LONG_LONG.
105+
104106
- Added PyObject_SelfIter() to fill the tp_iter slot for the
105107
typical case where the method returns its self argument.
106108

Modules/_testcapimodule.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ test_config(PyObject *self)
5656
CHECK_SIZEOF(SIZEOF_VOID_P, void*);
5757
CHECK_SIZEOF(SIZEOF_TIME_T, time_t);
5858
#ifdef HAVE_LONG_LONG
59-
CHECK_SIZEOF(SIZEOF_LONG_LONG, LONG_LONG);
59+
CHECK_SIZEOF(SIZEOF_LONG_LONG, PY_LONG_LONG);
6060
#endif
6161

6262
#undef CHECK_SIZEOF
@@ -172,7 +172,7 @@ test_dict_iteration(PyObject* self)
172172
173173
Note that the meat of the test is contained in testcapi_long.h.
174174
This is revolting, but delicate code duplication is worse: "almost
175-
exactly the same" code is needed to test LONG_LONG, but the ubiquitous
175+
exactly the same" code is needed to test PY_LONG_LONG, but the ubiquitous
176176
dependence on type names makes it impossible to use a parameterized
177177
function. A giant macro would be even worse than this. A C++ template
178178
would be perfect.
@@ -221,7 +221,7 @@ raise_test_longlong_error(const char* msg)
221221
}
222222

223223
#define TESTNAME test_longlong_api_inner
224-
#define TYPENAME LONG_LONG
224+
#define TYPENAME PY_LONG_LONG
225225
#define F_S_TO_PY PyLong_FromLongLong
226226
#define F_PY_TO_S PyLong_AsLongLong
227227
#define F_U_TO_PY PyLong_FromUnsignedLongLong
@@ -242,15 +242,15 @@ test_longlong_api(PyObject* self)
242242
#undef F_U_TO_PY
243243
#undef F_PY_TO_U
244244

245-
/* Test the L code for PyArg_ParseTuple. This should deliver a LONG_LONG
245+
/* Test the L code for PyArg_ParseTuple. This should deliver a PY_LONG_LONG
246246
for both long and int arguments. The test may leak a little memory if
247247
it fails.
248248
*/
249249
static PyObject *
250250
test_L_code(PyObject *self)
251251
{
252252
PyObject *tuple, *num;
253-
LONG_LONG value;
253+
PY_LONG_LONG value;
254254

255255
tuple = PyTuple_New(1);
256256
if (tuple == NULL)

Modules/addrinfo.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ struct addrinfo {
142142
*/
143143
#define _SS_MAXSIZE 128
144144
#ifdef HAVE_LONG_LONG
145-
#define _SS_ALIGNSIZE (sizeof(LONG_LONG))
145+
#define _SS_ALIGNSIZE (sizeof(PY_LONG_LONG))
146146
#else
147147
#define _SS_ALIGNSIZE (sizeof(double))
148148
#endif
@@ -159,7 +159,7 @@ struct sockaddr_storage {
159159
#endif
160160
char __ss_pad1[_SS_PAD1SIZE];
161161
#ifdef HAVE_LONG_LONG
162-
LONG_LONG __ss_align; /* force desired structure storage alignment */
162+
PY_LONG_LONG __ss_align; /* force desired structure storage alignment */
163163
#else
164164
double __ss_align; /* force desired structure storage alignment */
165165
#endif

Modules/bz2module.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ static char __author__[] =
3636
(((long)bzs->total_out_hi32 << 32) + bzs->total_out_lo32)
3737
#elif SIZEOF_LONG_LONG >= 8
3838
#define BZS_TOTAL_OUT(bzs) \
39-
(((LONG_LONG)bzs->total_out_hi32 << 32) + bzs->total_out_lo32)
39+
(((PY_LONG_LONG)bzs->total_out_hi32 << 32) + bzs->total_out_lo32)
4040
#else
4141
#define BZS_TOTAL_OUT(bzs) \
4242
bzs->total_out_lo32;
@@ -1490,7 +1490,7 @@ BZ2Comp_compress(BZ2CompObject *self, PyObject *args)
14901490
char *data;
14911491
int datasize;
14921492
int bufsize = SMALLCHUNK;
1493-
LONG_LONG totalout;
1493+
PY_LONG_LONG totalout;
14941494
PyObject *ret = NULL;
14951495
bz_stream *bzs = &self->bzs;
14961496
int bzerror;
@@ -1562,7 +1562,7 @@ BZ2Comp_flush(BZ2CompObject *self)
15621562
int bufsize = SMALLCHUNK;
15631563
PyObject *ret = NULL;
15641564
bz_stream *bzs = &self->bzs;
1565-
LONG_LONG totalout;
1565+
PY_LONG_LONG totalout;
15661566
int bzerror;
15671567

15681568
ACQUIRE_LOCK(self);
@@ -1768,7 +1768,7 @@ BZ2Decomp_decompress(BZ2DecompObject *self, PyObject *args)
17681768
char *data;
17691769
int datasize;
17701770
int bufsize = SMALLCHUNK;
1771-
LONG_LONG totalout;
1771+
PY_LONG_LONG totalout;
17721772
PyObject *ret = NULL;
17731773
bz_stream *bzs = &self->bzs;
17741774
int bzerror;

Modules/posixmodule.c

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -891,7 +891,7 @@ fill_time(PyObject *v, int index, time_t sec, unsigned long nsec)
891891
{
892892
PyObject *fval,*ival;
893893
#if SIZEOF_TIME_T > SIZEOF_LONG
894-
ival = PyLong_FromLongLong((LONG_LONG)sec);
894+
ival = PyLong_FromLongLong((PY_LONG_LONG)sec);
895895
#else
896896
ival = PyInt_FromLong((long)sec);
897897
#endif
@@ -918,13 +918,13 @@ _pystat_fromstructstat(STRUCT_STAT st)
918918
PyStructSequence_SET_ITEM(v, 0, PyInt_FromLong((long)st.st_mode));
919919
#ifdef HAVE_LARGEFILE_SUPPORT
920920
PyStructSequence_SET_ITEM(v, 1,
921-
PyLong_FromLongLong((LONG_LONG)st.st_ino));
921+
PyLong_FromLongLong((PY_LONG_LONG)st.st_ino));
922922
#else
923923
PyStructSequence_SET_ITEM(v, 1, PyInt_FromLong((long)st.st_ino));
924924
#endif
925925
#if defined(HAVE_LONG_LONG) && !defined(MS_WINDOWS)
926926
PyStructSequence_SET_ITEM(v, 2,
927-
PyLong_FromLongLong((LONG_LONG)st.st_dev));
927+
PyLong_FromLongLong((PY_LONG_LONG)st.st_dev));
928928
#else
929929
PyStructSequence_SET_ITEM(v, 2, PyInt_FromLong((long)st.st_dev));
930930
#endif
@@ -933,7 +933,7 @@ _pystat_fromstructstat(STRUCT_STAT st)
933933
PyStructSequence_SET_ITEM(v, 5, PyInt_FromLong((long)st.st_gid));
934934
#ifdef HAVE_LARGEFILE_SUPPORT
935935
PyStructSequence_SET_ITEM(v, 6,
936-
PyLong_FromLongLong((LONG_LONG)st.st_size));
936+
PyLong_FromLongLong((PY_LONG_LONG)st.st_size));
937937
#else
938938
PyStructSequence_SET_ITEM(v, 6, PyInt_FromLong(st.st_size));
939939
#endif
@@ -2376,7 +2376,7 @@ posix_spawnv(PyObject *self, PyObject *args)
23762376
#if SIZEOF_LONG == SIZEOF_VOID_P
23772377
return Py_BuildValue("l", (long) spawnval);
23782378
#else
2379-
return Py_BuildValue("L", (LONG_LONG) spawnval);
2379+
return Py_BuildValue("L", (PY_LONG_LONG) spawnval);
23802380
#endif
23812381
}
23822382

@@ -2517,7 +2517,7 @@ posix_spawnve(PyObject *self, PyObject *args)
25172517
#if SIZEOF_LONG == SIZEOF_VOID_P
25182518
res = Py_BuildValue("l", (long) spawnval);
25192519
#else
2520-
res = Py_BuildValue("L", (LONG_LONG) spawnval);
2520+
res = Py_BuildValue("L", (PY_LONG_LONG) spawnval);
25212521
#endif
25222522

25232523
fail_2:
@@ -5084,7 +5084,7 @@ posix_lseek(PyObject *self, PyObject *args)
50845084
{
50855085
int fd, how;
50865086
#if defined(MS_WIN64) || defined(MS_WINDOWS)
5087-
LONG_LONG pos, res;
5087+
PY_LONG_LONG pos, res;
50885088
#else
50895089
off_t pos, res;
50905090
#endif
@@ -5816,17 +5816,17 @@ _pystatvfs_fromstructstatvfs(struct statvfs st) {
58165816
PyStructSequence_SET_ITEM(v, 0, PyInt_FromLong((long) st.f_bsize));
58175817
PyStructSequence_SET_ITEM(v, 1, PyInt_FromLong((long) st.f_frsize));
58185818
PyStructSequence_SET_ITEM(v, 2,
5819-
PyLong_FromLongLong((LONG_LONG) st.f_blocks));
5819+
PyLong_FromLongLong((PY_LONG_LONG) st.f_blocks));
58205820
PyStructSequence_SET_ITEM(v, 3,
5821-
PyLong_FromLongLong((LONG_LONG) st.f_bfree));
5821+
PyLong_FromLongLong((PY_LONG_LONG) st.f_bfree));
58225822
PyStructSequence_SET_ITEM(v, 4,
5823-
PyLong_FromLongLong((LONG_LONG) st.f_bavail));
5823+
PyLong_FromLongLong((PY_LONG_LONG) st.f_bavail));
58245824
PyStructSequence_SET_ITEM(v, 5,
5825-
PyLong_FromLongLong((LONG_LONG) st.f_files));
5825+
PyLong_FromLongLong((PY_LONG_LONG) st.f_files));
58265826
PyStructSequence_SET_ITEM(v, 6,
5827-
PyLong_FromLongLong((LONG_LONG) st.f_ffree));
5827+
PyLong_FromLongLong((PY_LONG_LONG) st.f_ffree));
58285828
PyStructSequence_SET_ITEM(v, 7,
5829-
PyLong_FromLongLong((LONG_LONG) st.f_favail));
5829+
PyLong_FromLongLong((PY_LONG_LONG) st.f_favail));
58305830
PyStructSequence_SET_ITEM(v, 8, PyInt_FromLong((long) st.f_flag));
58315831
PyStructSequence_SET_ITEM(v, 9, PyInt_FromLong((long) st.f_namemax));
58325832
#endif

Modules/resource.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -128,8 +128,8 @@ resource_getrlimit(PyObject *self, PyObject *args)
128128
#if defined(HAVE_LONG_LONG)
129129
if (sizeof(rl.rlim_cur) > sizeof(long)) {
130130
return Py_BuildValue("LL",
131-
(LONG_LONG) rl.rlim_cur,
132-
(LONG_LONG) rl.rlim_max);
131+
(PY_LONG_LONG) rl.rlim_cur,
132+
(PY_LONG_LONG) rl.rlim_max);
133133
}
134134
#endif
135135
return Py_BuildValue("ll", (long) rl.rlim_cur, (long) rl.rlim_max);
@@ -292,7 +292,7 @@ initresource(void)
292292

293293
#if defined(HAVE_LONG_LONG)
294294
if (sizeof(RLIM_INFINITY) > sizeof(long)) {
295-
v = PyLong_FromLongLong((LONG_LONG) RLIM_INFINITY);
295+
v = PyLong_FromLongLong((PY_LONG_LONG) RLIM_INFINITY);
296296
} else
297297
#endif
298298
{

Modules/socketmodule.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1437,7 +1437,7 @@ sock_fileno(PySocketSockObject *s)
14371437
#if SIZEOF_SOCKET_T <= SIZEOF_LONG
14381438
return PyInt_FromLong((long) s->sock_fd);
14391439
#else
1440-
return PyLong_FromLongLong((LONG_LONG)s->sock_fd);
1440+
return PyLong_FromLongLong((PY_LONG_LONG)s->sock_fd);
14411441
#endif
14421442
}
14431443

0 commit comments

Comments
 (0)