X Tutup
Skip to content

Commit 460bd0d

Browse files
Issue python#19569: Compiler warnings are now emitted if use most of deprecated
functions.
1 parent 6107f46 commit 460bd0d

File tree

18 files changed

+143
-142
lines changed

18 files changed

+143
-142
lines changed

Include/abstract.h

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -549,7 +549,8 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
549549

550550
PyAPI_FUNC(int) PyObject_AsCharBuffer(PyObject *obj,
551551
const char **buffer,
552-
Py_ssize_t *buffer_len);
552+
Py_ssize_t *buffer_len)
553+
Py_DEPRECATED(3.0);
553554

554555
/*
555556
Takes an arbitrary object which must support the (character,
@@ -562,7 +563,8 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
562563
an exception set.
563564
*/
564565

565-
PyAPI_FUNC(int) PyObject_CheckReadBuffer(PyObject *obj);
566+
PyAPI_FUNC(int) PyObject_CheckReadBuffer(PyObject *obj)
567+
Py_DEPRECATED(3.0);
566568

567569
/*
568570
Checks whether an arbitrary object supports the (character,
@@ -572,7 +574,8 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
572574

573575
PyAPI_FUNC(int) PyObject_AsReadBuffer(PyObject *obj,
574576
const void **buffer,
575-
Py_ssize_t *buffer_len);
577+
Py_ssize_t *buffer_len)
578+
Py_DEPRECATED(3.0);
576579

577580
/*
578581
Same as PyObject_AsCharBuffer() except that this API expects
@@ -587,7 +590,8 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
587590

588591
PyAPI_FUNC(int) PyObject_AsWriteBuffer(PyObject *obj,
589592
void **buffer,
590-
Py_ssize_t *buffer_len);
593+
Py_ssize_t *buffer_len)
594+
Py_DEPRECATED(3.0);
591595

592596
/*
593597
Takes an arbitrary object which must support the (writable,

Include/ceval.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -182,8 +182,8 @@ PyAPI_FUNC(void) PyEval_InitThreads(void);
182182
#ifndef Py_LIMITED_API
183183
PyAPI_FUNC(void) _PyEval_FiniThreads(void);
184184
#endif /* !Py_LIMITED_API */
185-
PyAPI_FUNC(void) PyEval_AcquireLock(void);
186-
PyAPI_FUNC(void) PyEval_ReleaseLock(void);
185+
PyAPI_FUNC(void) PyEval_AcquireLock(void) Py_DEPRECATED(3.2);
186+
PyAPI_FUNC(void) PyEval_ReleaseLock(void) /* Py_DEPRECATED(3.2) */;
187187
PyAPI_FUNC(void) PyEval_AcquireThread(PyThreadState *tstate);
188188
PyAPI_FUNC(void) PyEval_ReleaseThread(PyThreadState *tstate);
189189
PyAPI_FUNC(void) PyEval_ReInitThreads(void);

Include/longobject.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ PyAPI_FUNC(long long) PyLong_AsLongLongAndOverflow(PyObject *, int *);
9494

9595
PyAPI_FUNC(PyObject *) PyLong_FromString(const char *, char **, int);
9696
#ifndef Py_LIMITED_API
97-
PyAPI_FUNC(PyObject *) PyLong_FromUnicode(Py_UNICODE*, Py_ssize_t, int);
97+
PyAPI_FUNC(PyObject *) PyLong_FromUnicode(Py_UNICODE*, Py_ssize_t, int) Py_DEPRECATED(3.3);
9898
PyAPI_FUNC(PyObject *) PyLong_FromUnicodeObject(PyObject *u, int base);
9999
PyAPI_FUNC(PyObject *) _PyLong_FromBytes(const char *, Py_ssize_t, int);
100100
#endif

Include/moduleobject.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ PyAPI_FUNC(PyObject *) PyModule_New(
2121
PyAPI_FUNC(PyObject *) PyModule_GetDict(PyObject *);
2222
PyAPI_FUNC(PyObject *) PyModule_GetNameObject(PyObject *);
2323
PyAPI_FUNC(const char *) PyModule_GetName(PyObject *);
24-
PyAPI_FUNC(const char *) PyModule_GetFilename(PyObject *);
24+
PyAPI_FUNC(const char *) PyModule_GetFilename(PyObject *) Py_DEPRECATED(3.2);
2525
PyAPI_FUNC(PyObject *) PyModule_GetFilenameObject(PyObject *);
2626
#ifndef Py_LIMITED_API
2727
PyAPI_FUNC(void) _PyModule_Clear(PyObject *);

Include/pyerrors.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ PyAPI_FUNC(PyObject *) PyErr_SetFromErrnoWithFilename(
240240
);
241241
#if defined(MS_WINDOWS) && !defined(Py_LIMITED_API)
242242
PyAPI_FUNC(PyObject *) PyErr_SetFromErrnoWithUnicodeFilename(
243-
PyObject *, const Py_UNICODE *);
243+
PyObject *, const Py_UNICODE *) Py_DEPRECATED(3.3);
244244
#endif /* MS_WINDOWS */
245245

246246
PyAPI_FUNC(PyObject *) PyErr_Format(
@@ -274,7 +274,7 @@ PyAPI_FUNC(PyObject *) PyErr_SetFromWindowsErrWithFilename(
274274
#ifndef Py_LIMITED_API
275275
/* XXX redeclare to use WSTRING */
276276
PyAPI_FUNC(PyObject *) PyErr_SetFromWindowsErrWithUnicodeFilename(
277-
int, const Py_UNICODE *);
277+
int, const Py_UNICODE *) Py_DEPRECATED(3.3);
278278
#endif
279279
PyAPI_FUNC(PyObject *) PyErr_SetFromWindowsErr(int);
280280
PyAPI_FUNC(PyObject *) PyErr_SetExcFromWindowsErrWithFilenameObject(
@@ -288,7 +288,7 @@ PyAPI_FUNC(PyObject *) PyErr_SetExcFromWindowsErrWithFilename(
288288
);
289289
#ifndef Py_LIMITED_API
290290
PyAPI_FUNC(PyObject *) PyErr_SetExcFromWindowsErrWithUnicodeFilename(
291-
PyObject *,int, const Py_UNICODE *);
291+
PyObject *,int, const Py_UNICODE *) Py_DEPRECATED(3.3);
292292
#endif
293293
PyAPI_FUNC(PyObject *) PyErr_SetExcFromWindowsErr(PyObject *, int);
294294
#endif /* MS_WINDOWS */
@@ -391,7 +391,7 @@ PyAPI_FUNC(PyObject *) PyUnicodeEncodeError_Create(
391391
Py_ssize_t start,
392392
Py_ssize_t end,
393393
const char *reason /* UTF-8 encoded string */
394-
);
394+
) Py_DEPRECATED(3.3);
395395
#endif
396396

397397
/* create a UnicodeTranslateError object */
@@ -402,7 +402,7 @@ PyAPI_FUNC(PyObject *) PyUnicodeTranslateError_Create(
402402
Py_ssize_t start,
403403
Py_ssize_t end,
404404
const char *reason /* UTF-8 encoded string */
405-
);
405+
) Py_DEPRECATED(3.3);
406406
PyAPI_FUNC(PyObject *) _PyUnicodeTranslateError_Create(
407407
PyObject *object,
408408
Py_ssize_t start,

Include/unicodeobject.h

Lines changed: 36 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ Copyright (c) Corporation for National Research Initiatives.
9090

9191
#ifndef Py_LIMITED_API
9292
#define PY_UNICODE_TYPE wchar_t
93-
typedef wchar_t Py_UNICODE;
93+
typedef wchar_t Py_UNICODE /* Py_DEPRECATED(3.3) */;
9494
#endif
9595

9696
/* If the compiler provides a wchar_t type we try to support it
@@ -387,9 +387,11 @@ PyAPI_DATA(PyTypeObject) PyUnicodeIter_Type;
387387
((void)PyUnicode_AsUnicode((PyObject *)(op)), \
388388
assert(((PyASCIIObject *)(op))->wstr), \
389389
PyUnicode_WSTR_LENGTH(op)))
390+
/* Py_DEPRECATED(3.3) */
390391

391392
#define PyUnicode_GET_DATA_SIZE(op) \
392393
(PyUnicode_GET_SIZE(op) * Py_UNICODE_SIZE)
394+
/* Py_DEPRECATED(3.3) */
393395

394396
/* Alias for PyUnicode_AsUnicode(). This will create a wchar_t/Py_UNICODE
395397
representation on demand. Using this macro is very inefficient now,
@@ -400,9 +402,11 @@ PyAPI_DATA(PyTypeObject) PyUnicodeIter_Type;
400402
(assert(PyUnicode_Check(op)), \
401403
(((PyASCIIObject *)(op))->wstr) ? (((PyASCIIObject *)(op))->wstr) : \
402404
PyUnicode_AsUnicode((PyObject *)(op)))
405+
/* Py_DEPRECATED(3.3) */
403406

404407
#define PyUnicode_AS_DATA(op) \
405408
((const char *)(PyUnicode_AS_UNICODE(op)))
409+
/* Py_DEPRECATED(3.3) */
406410

407411

408412
/* --- Flexible String Representation Helper Macros (PEP 393) -------------- */
@@ -688,7 +692,7 @@ PyAPI_FUNC(void) _PyUnicode_FastFill(
688692
PyAPI_FUNC(PyObject*) PyUnicode_FromUnicode(
689693
const Py_UNICODE *u, /* Unicode buffer */
690694
Py_ssize_t size /* size of buffer */
691-
);
695+
) /* Py_DEPRECATED(3.3) */;
692696
#endif
693697

694698
/* Similar to PyUnicode_FromUnicode(), but u points to UTF-8 encoded bytes */
@@ -756,7 +760,7 @@ PyAPI_FUNC(Py_UCS4*) PyUnicode_AsUCS4Copy(PyObject *unicode);
756760
#ifndef Py_LIMITED_API
757761
PyAPI_FUNC(Py_UNICODE *) PyUnicode_AsUnicode(
758762
PyObject *unicode /* Unicode object */
759-
);
763+
) /* Py_DEPRECATED(3.3) */;
760764
#endif
761765

762766
/* Return a read-only pointer to the Unicode object's internal
@@ -768,7 +772,7 @@ PyAPI_FUNC(Py_UNICODE *) PyUnicode_AsUnicode(
768772
PyAPI_FUNC(Py_UNICODE *) PyUnicode_AsUnicodeAndSize(
769773
PyObject *unicode, /* Unicode object */
770774
Py_ssize_t *size /* location where to save the length */
771-
);
775+
) /* Py_DEPRECATED(3.3) */;
772776
#endif
773777

774778
/* Get the length of the Unicode object. */
@@ -782,7 +786,7 @@ PyAPI_FUNC(Py_ssize_t) PyUnicode_GetLength(
782786

783787
PyAPI_FUNC(Py_ssize_t) PyUnicode_GetSize(
784788
PyObject *unicode /* Unicode object */
785-
);
789+
) Py_DEPRECATED(3.3);
786790

787791
/* Read a character from the string. */
788792

@@ -804,7 +808,7 @@ PyAPI_FUNC(int) PyUnicode_WriteChar(
804808

805809
#ifndef Py_LIMITED_API
806810
/* Get the maximum ordinal for a Unicode character. */
807-
PyAPI_FUNC(Py_UNICODE) PyUnicode_GetMax(void);
811+
PyAPI_FUNC(Py_UNICODE) PyUnicode_GetMax(void) Py_DEPRECATED(3.3);
808812
#endif
809813

810814
/* Resize a Unicode object. The length is the number of characters, except
@@ -1205,7 +1209,7 @@ PyAPI_FUNC(PyObject*) PyUnicode_Encode(
12051209
Py_ssize_t size, /* number of Py_UNICODE chars to encode */
12061210
const char *encoding, /* encoding */
12071211
const char *errors /* error handling */
1208-
);
1212+
) Py_DEPRECATED(3.3);
12091213
#endif
12101214

12111215
/* Encodes a Unicode object and returns the result as Python
@@ -1272,7 +1276,7 @@ PyAPI_FUNC(PyObject*) PyUnicode_EncodeUTF7(
12721276
int base64SetO, /* Encode RFC2152 Set O characters in base64 */
12731277
int base64WhiteSpace, /* Encode whitespace (sp, ht, nl, cr) in base64 */
12741278
const char *errors /* error handling */
1275-
);
1279+
) Py_DEPRECATED(3.3);
12761280
PyAPI_FUNC(PyObject*) _PyUnicode_EncodeUTF7(
12771281
PyObject *unicode, /* Unicode object */
12781282
int base64SetO, /* Encode RFC2152 Set O characters in base64 */
@@ -1309,7 +1313,7 @@ PyAPI_FUNC(PyObject*) PyUnicode_EncodeUTF8(
13091313
const Py_UNICODE *data, /* Unicode char buffer */
13101314
Py_ssize_t length, /* number of Py_UNICODE chars to encode */
13111315
const char *errors /* error handling */
1312-
);
1316+
) Py_DEPRECATED(3.3);
13131317
#endif
13141318

13151319
/* --- UTF-32 Codecs ------------------------------------------------------ */
@@ -1385,7 +1389,7 @@ PyAPI_FUNC(PyObject*) PyUnicode_EncodeUTF32(
13851389
Py_ssize_t length, /* number of Py_UNICODE chars to encode */
13861390
const char *errors, /* error handling */
13871391
int byteorder /* byteorder to use 0=BOM+native;-1=LE,1=BE */
1388-
);
1392+
) Py_DEPRECATED(3.3);
13891393
PyAPI_FUNC(PyObject*) _PyUnicode_EncodeUTF32(
13901394
PyObject *object, /* Unicode object */
13911395
const char *errors, /* error handling */
@@ -1470,7 +1474,7 @@ PyAPI_FUNC(PyObject*) PyUnicode_EncodeUTF16(
14701474
Py_ssize_t length, /* number of Py_UNICODE chars to encode */
14711475
const char *errors, /* error handling */
14721476
int byteorder /* byteorder to use 0=BOM+native;-1=LE,1=BE */
1473-
);
1477+
) Py_DEPRECATED(3.3);
14741478
PyAPI_FUNC(PyObject*) _PyUnicode_EncodeUTF16(
14751479
PyObject* unicode, /* Unicode object */
14761480
const char *errors, /* error handling */
@@ -1505,7 +1509,7 @@ PyAPI_FUNC(PyObject*) PyUnicode_AsUnicodeEscapeString(
15051509
PyAPI_FUNC(PyObject*) PyUnicode_EncodeUnicodeEscape(
15061510
const Py_UNICODE *data, /* Unicode char buffer */
15071511
Py_ssize_t length /* Number of Py_UNICODE chars to encode */
1508-
);
1512+
) Py_DEPRECATED(3.3);
15091513
#endif
15101514

15111515
/* --- Raw-Unicode-Escape Codecs ------------------------------------------ */
@@ -1524,7 +1528,7 @@ PyAPI_FUNC(PyObject*) PyUnicode_AsRawUnicodeEscapeString(
15241528
PyAPI_FUNC(PyObject*) PyUnicode_EncodeRawUnicodeEscape(
15251529
const Py_UNICODE *data, /* Unicode char buffer */
15261530
Py_ssize_t length /* Number of Py_UNICODE chars to encode */
1527-
);
1531+
) Py_DEPRECATED(3.3);
15281532
#endif
15291533

15301534
/* --- Unicode Internal Codec ---------------------------------------------
@@ -1564,7 +1568,7 @@ PyAPI_FUNC(PyObject*) PyUnicode_EncodeLatin1(
15641568
const Py_UNICODE *data, /* Unicode char buffer */
15651569
Py_ssize_t length, /* Number of Py_UNICODE chars to encode */
15661570
const char *errors /* error handling */
1567-
);
1571+
) Py_DEPRECATED(3.3);
15681572
#endif
15691573

15701574
/* --- ASCII Codecs -------------------------------------------------------
@@ -1592,7 +1596,7 @@ PyAPI_FUNC(PyObject*) PyUnicode_EncodeASCII(
15921596
const Py_UNICODE *data, /* Unicode char buffer */
15931597
Py_ssize_t length, /* Number of Py_UNICODE chars to encode */
15941598
const char *errors /* error handling */
1595-
);
1599+
) Py_DEPRECATED(3.3);
15961600
#endif
15971601

15981602
/* --- Character Map Codecs -----------------------------------------------
@@ -1638,7 +1642,7 @@ PyAPI_FUNC(PyObject*) PyUnicode_EncodeCharmap(
16381642
PyObject *mapping, /* character mapping
16391643
(unicode ordinal -> char ordinal) */
16401644
const char *errors /* error handling */
1641-
);
1645+
) Py_DEPRECATED(3.3);
16421646
PyAPI_FUNC(PyObject*) _PyUnicode_EncodeCharmap(
16431647
PyObject *unicode, /* Unicode object */
16441648
PyObject *mapping, /* character mapping
@@ -1666,7 +1670,7 @@ PyAPI_FUNC(PyObject *) PyUnicode_TranslateCharmap(
16661670
Py_ssize_t length, /* Number of Py_UNICODE chars to encode */
16671671
PyObject *table, /* Translate table */
16681672
const char *errors /* error handling */
1669-
);
1673+
) Py_DEPRECATED(3.3);
16701674
#endif
16711675

16721676
#ifdef MS_WINDOWS
@@ -1703,7 +1707,7 @@ PyAPI_FUNC(PyObject*) PyUnicode_EncodeMBCS(
17031707
const Py_UNICODE *data, /* Unicode char buffer */
17041708
Py_ssize_t length, /* number of Py_UNICODE chars to encode */
17051709
const char *errors /* error handling */
1706-
);
1710+
) Py_DEPRECATED(3.3);
17071711
#endif
17081712

17091713
PyAPI_FUNC(PyObject*) PyUnicode_EncodeCodePage(
@@ -1744,7 +1748,7 @@ PyAPI_FUNC(int) PyUnicode_EncodeDecimal(
17441748
Py_ssize_t length, /* Number of Py_UNICODE chars to encode */
17451749
char *output, /* Output buffer; must have size >= length */
17461750
const char *errors /* error handling */
1747-
);
1751+
) /* Py_DEPRECATED(3.3) */;
17481752
#endif
17491753

17501754
/* Transforms code points that have decimal digit property to the
@@ -1757,7 +1761,7 @@ PyAPI_FUNC(int) PyUnicode_EncodeDecimal(
17571761
PyAPI_FUNC(PyObject*) PyUnicode_TransformDecimalToASCII(
17581762
Py_UNICODE *s, /* Unicode buffer */
17591763
Py_ssize_t length /* Number of Py_UNICODE chars to transform */
1760-
);
1764+
) /* Py_DEPRECATED(3.3) */;
17611765
#endif
17621766

17631767
/* Similar to PyUnicode_TransformDecimalToASCII(), but takes a PyObject
@@ -2182,15 +2186,15 @@ PyAPI_FUNC(int) _PyUnicode_IsLinebreak(
21822186

21832187
PyAPI_FUNC(Py_UCS4) _PyUnicode_ToLowercase(
21842188
Py_UCS4 ch /* Unicode character */
2185-
);
2189+
) /* Py_DEPRECATED(3.3) */;
21862190

21872191
PyAPI_FUNC(Py_UCS4) _PyUnicode_ToUppercase(
21882192
Py_UCS4 ch /* Unicode character */
2189-
);
2193+
) /* Py_DEPRECATED(3.3) */;
21902194

21912195
PyAPI_FUNC(Py_UCS4) _PyUnicode_ToTitlecase(
21922196
Py_UCS4 ch /* Unicode character */
2193-
);
2197+
) Py_DEPRECATED(3.3);
21942198

21952199
PyAPI_FUNC(int) _PyUnicode_ToLowerFull(
21962200
Py_UCS4 ch, /* Unicode character */
@@ -2254,40 +2258,40 @@ PyAPI_FUNC(int) _PyUnicode_IsAlpha(
22542258

22552259
PyAPI_FUNC(size_t) Py_UNICODE_strlen(
22562260
const Py_UNICODE *u
2257-
);
2261+
) Py_DEPRECATED(3.3);
22582262

22592263
PyAPI_FUNC(Py_UNICODE*) Py_UNICODE_strcpy(
22602264
Py_UNICODE *s1,
2261-
const Py_UNICODE *s2);
2265+
const Py_UNICODE *s2) Py_DEPRECATED(3.3);
22622266

22632267
PyAPI_FUNC(Py_UNICODE*) Py_UNICODE_strcat(
2264-
Py_UNICODE *s1, const Py_UNICODE *s2);
2268+
Py_UNICODE *s1, const Py_UNICODE *s2) Py_DEPRECATED(3.3);
22652269

22662270
PyAPI_FUNC(Py_UNICODE*) Py_UNICODE_strncpy(
22672271
Py_UNICODE *s1,
22682272
const Py_UNICODE *s2,
2269-
size_t n);
2273+
size_t n) Py_DEPRECATED(3.3);
22702274

22712275
PyAPI_FUNC(int) Py_UNICODE_strcmp(
22722276
const Py_UNICODE *s1,
22732277
const Py_UNICODE *s2
2274-
);
2278+
) Py_DEPRECATED(3.3);
22752279

22762280
PyAPI_FUNC(int) Py_UNICODE_strncmp(
22772281
const Py_UNICODE *s1,
22782282
const Py_UNICODE *s2,
22792283
size_t n
2280-
);
2284+
) Py_DEPRECATED(3.3);
22812285

22822286
PyAPI_FUNC(Py_UNICODE*) Py_UNICODE_strchr(
22832287
const Py_UNICODE *s,
22842288
Py_UNICODE c
2285-
);
2289+
) Py_DEPRECATED(3.3);
22862290

22872291
PyAPI_FUNC(Py_UNICODE*) Py_UNICODE_strrchr(
22882292
const Py_UNICODE *s,
22892293
Py_UNICODE c
2290-
);
2294+
) Py_DEPRECATED(3.3);
22912295

22922296
PyAPI_FUNC(PyObject*) _PyUnicode_FormatLong(PyObject *, int, int, int);
22932297

@@ -2297,7 +2301,7 @@ PyAPI_FUNC(PyObject*) _PyUnicode_FormatLong(PyObject *, int, int, int);
22972301

22982302
PyAPI_FUNC(Py_UNICODE*) PyUnicode_AsUnicodeCopy(
22992303
PyObject *unicode
2300-
);
2304+
) Py_DEPRECATED(3.3);
23012305
#endif /* Py_LIMITED_API */
23022306

23032307
#if defined(Py_DEBUG) && !defined(Py_LIMITED_API)

0 commit comments

Comments
 (0)
X Tutup