diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2016-12-27 13:04:59 (GMT) |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2016-12-27 13:04:59 (GMT) |
commit | a171a03bd23c0fb9b424cce879d4c0b53fc331f6 (patch) | |
tree | fcd116721c8e55af5d9163543f956ce1fa7edfde /Include | |
parent | fdb4eafacf9e1fd2c352f8d7ae43d833ee47d6a3 (diff) | |
parent | 34d0ac8027e23609e24588735b37b8d5a55f7223 (diff) | |
download | cpython-a171a03bd23c0fb9b424cce879d4c0b53fc331f6.zip cpython-a171a03bd23c0fb9b424cce879d4c0b53fc331f6.tar.gz cpython-a171a03bd23c0fb9b424cce879d4c0b53fc331f6.tar.bz2 |
Issue #29058: All stable API extensions added after Python 3.2 are now
available only when Py_LIMITED_API is set to the PY_VERSION_HEX value of
the minimum Python version supporting this API.
Diffstat (limited to 'Include')
-rw-r--r-- | Include/abstract.h | 4 | ||||
-rw-r--r-- | Include/bytesobject.h | 2 | ||||
-rw-r--r-- | Include/codecs.h | 4 | ||||
-rw-r--r-- | Include/fileobject.h | 2 | ||||
-rw-r--r-- | Include/fileutils.h | 2 | ||||
-rw-r--r-- | Include/import.h | 10 | ||||
-rw-r--r-- | Include/memoryobject.h | 2 | ||||
-rw-r--r-- | Include/moduleobject.h | 4 | ||||
-rw-r--r-- | Include/object.h | 2 | ||||
-rw-r--r-- | Include/objimpl.h | 2 | ||||
-rw-r--r-- | Include/odictobject.h | 9 | ||||
-rw-r--r-- | Include/osmodule.h | 2 | ||||
-rw-r--r-- | Include/pyerrors.h | 21 | ||||
-rw-r--r-- | Include/pymem.h | 2 | ||||
-rw-r--r-- | Include/pythonrun.h | 2 | ||||
-rw-r--r-- | Include/pythread.h | 2 | ||||
-rw-r--r-- | Include/unicodeobject.h | 18 | ||||
-rw-r--r-- | Include/warnings.h | 2 |
18 files changed, 85 insertions, 7 deletions
diff --git a/Include/abstract.h b/Include/abstract.h index cfd240c..f7d7dcc 100644 --- a/Include/abstract.h +++ b/Include/abstract.h @@ -612,8 +612,10 @@ PyAPI_FUNC(PyObject *) PyNumber_Subtract(PyObject *o1, PyObject *o2); This is the equivalent of the Python expression: o1 * o2. */ PyAPI_FUNC(PyObject *) PyNumber_Multiply(PyObject *o1, PyObject *o2); +#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03050000 /* This is the equivalent of the Python expression: o1 @ o2. */ PyAPI_FUNC(PyObject *) PyNumber_MatrixMultiply(PyObject *o1, PyObject *o2); +#endif /* Returns the result of dividing o1 by o2 giving an integral result, or NULL on failure. @@ -743,8 +745,10 @@ PyAPI_FUNC(PyObject *) PyNumber_InPlaceSubtract(PyObject *o1, PyObject *o2); This is the equivalent of the Python expression: o1 *= o2. */ PyAPI_FUNC(PyObject *) PyNumber_InPlaceMultiply(PyObject *o1, PyObject *o2); +#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03050000 /* This is the equivalent of the Python expression: o1 @= o2. */ PyAPI_FUNC(PyObject *) PyNumber_InPlaceMatrixMultiply(PyObject *o1, PyObject *o2); +#endif /* Returns the result of dividing o1 by o2 giving an integral result, possibly in-place, or NULL on failure. diff --git a/Include/bytesobject.h b/Include/bytesobject.h index 98e29b6..0f0bf9f 100644 --- a/Include/bytesobject.h +++ b/Include/bytesobject.h @@ -74,11 +74,13 @@ PyAPI_FUNC(PyObject*) _PyBytes_FromHex( PyAPI_FUNC(PyObject *) PyBytes_DecodeEscape(const char *, Py_ssize_t, const char *, Py_ssize_t, const char *); +#ifndef Py_LIMITED_API /* Helper for PyBytes_DecodeEscape that detects invalid escape chars. */ PyAPI_FUNC(PyObject *) _PyBytes_DecodeEscape(const char *, Py_ssize_t, const char *, Py_ssize_t, const char *, const char **); +#endif /* Macro, trading safety for speed */ #ifndef Py_LIMITED_API diff --git a/Include/codecs.h b/Include/codecs.h index f8275a1..3ad0f2b 100644 --- a/Include/codecs.h +++ b/Include/codecs.h @@ -225,10 +225,14 @@ PyAPI_FUNC(PyObject *) PyCodec_XMLCharRefReplaceErrors(PyObject *exc); /* replace the unicode encode error with backslash escapes (\x, \u and \U) */ PyAPI_FUNC(PyObject *) PyCodec_BackslashReplaceErrors(PyObject *exc); +#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03050000 /* replace the unicode encode error with backslash escapes (\N, \x, \u and \U) */ PyAPI_FUNC(PyObject *) PyCodec_NameReplaceErrors(PyObject *exc); +#endif +#ifndef Py_LIMITED_API PyAPI_DATA(const char *) Py_hexdigits; +#endif #ifdef __cplusplus } diff --git a/Include/fileobject.h b/Include/fileobject.h index 03984ba..6120e51 100644 --- a/Include/fileobject.h +++ b/Include/fileobject.h @@ -23,7 +23,9 @@ PyAPI_FUNC(char *) Py_UniversalNewlineFgets(char *, int, FILE*, PyObject *); If non-NULL, this is different than the default encoding for strings */ PyAPI_DATA(const char *) Py_FileSystemDefaultEncoding; +#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03060000 PyAPI_DATA(const char *) Py_FileSystemDefaultEncodeErrors; +#endif PyAPI_DATA(int) Py_HasFileSystemDefaultEncoding; /* Internal API diff --git a/Include/fileutils.h b/Include/fileutils.h index 4016431..b933e98 100644 --- a/Include/fileutils.h +++ b/Include/fileutils.h @@ -5,6 +5,7 @@ extern "C" { #endif +#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03050000 PyAPI_FUNC(wchar_t *) Py_DecodeLocale( const char *arg, size_t *size); @@ -12,6 +13,7 @@ PyAPI_FUNC(wchar_t *) Py_DecodeLocale( PyAPI_FUNC(char*) Py_EncodeLocale( const wchar_t *text, size_t *error_pos); +#endif #ifndef Py_LIMITED_API diff --git a/Include/import.h b/Include/import.h index 46c0d8e..bb6beba6 100644 --- a/Include/import.h +++ b/Include/import.h @@ -9,9 +9,9 @@ extern "C" { #ifndef Py_LIMITED_API PyAPI_FUNC(void) _PyImportZip_Init(void); -#endif /* !Py_LIMITED_API */ PyMODINIT_FUNC PyInit_imp(void); +#endif /* !Py_LIMITED_API */ PyAPI_FUNC(long) PyImport_GetMagicNumber(void); PyAPI_FUNC(const char *) PyImport_GetMagicTag(void); PyAPI_FUNC(PyObject *) PyImport_ExecCodeModule( @@ -29,16 +29,20 @@ PyAPI_FUNC(PyObject *) PyImport_ExecCodeModuleWithPathnames( const char *pathname, /* decoded from the filesystem encoding */ const char *cpathname /* decoded from the filesystem encoding */ ); +#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03030000 PyAPI_FUNC(PyObject *) PyImport_ExecCodeModuleObject( PyObject *name, PyObject *co, PyObject *pathname, PyObject *cpathname ); +#endif PyAPI_FUNC(PyObject *) PyImport_GetModuleDict(void); +#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03030000 PyAPI_FUNC(PyObject *) PyImport_AddModuleObject( PyObject *name ); +#endif PyAPI_FUNC(PyObject *) PyImport_AddModule( const char *name /* UTF-8 encoded string */ ); @@ -55,6 +59,7 @@ PyAPI_FUNC(PyObject *) PyImport_ImportModuleLevel( PyObject *fromlist, int level ); +#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03050000 PyAPI_FUNC(PyObject *) PyImport_ImportModuleLevelObject( PyObject *name, PyObject *globals, @@ -62,6 +67,7 @@ PyAPI_FUNC(PyObject *) PyImport_ImportModuleLevelObject( PyObject *fromlist, int level ); +#endif #define PyImport_ImportModuleEx(n, g, l, f) \ PyImport_ImportModuleLevel(n, g, l, f, 0) @@ -70,9 +76,11 @@ PyAPI_FUNC(PyObject *) PyImport_GetImporter(PyObject *path); PyAPI_FUNC(PyObject *) PyImport_Import(PyObject *name); PyAPI_FUNC(PyObject *) PyImport_ReloadModule(PyObject *m); PyAPI_FUNC(void) PyImport_Cleanup(void); +#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03030000 PyAPI_FUNC(int) PyImport_ImportFrozenModuleObject( PyObject *name ); +#endif PyAPI_FUNC(int) PyImport_ImportFrozenModule( const char *name /* UTF-8 encoded string */ ); diff --git a/Include/memoryobject.h b/Include/memoryobject.h index ab5ee09..990a716 100644 --- a/Include/memoryobject.h +++ b/Include/memoryobject.h @@ -21,8 +21,10 @@ PyAPI_DATA(PyTypeObject) PyMemoryView_Type; #endif PyAPI_FUNC(PyObject *) PyMemoryView_FromObject(PyObject *base); +#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03030000 PyAPI_FUNC(PyObject *) PyMemoryView_FromMemory(char *mem, Py_ssize_t size, int flags); +#endif #ifndef Py_LIMITED_API PyAPI_FUNC(PyObject *) PyMemoryView_FromBuffer(Py_buffer *info); #endif diff --git a/Include/moduleobject.h b/Include/moduleobject.h index 43b6848..1d8fe46 100644 --- a/Include/moduleobject.h +++ b/Include/moduleobject.h @@ -12,14 +12,18 @@ PyAPI_DATA(PyTypeObject) PyModule_Type; #define PyModule_Check(op) PyObject_TypeCheck(op, &PyModule_Type) #define PyModule_CheckExact(op) (Py_TYPE(op) == &PyModule_Type) +#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03030000 PyAPI_FUNC(PyObject *) PyModule_NewObject( PyObject *name ); +#endif PyAPI_FUNC(PyObject *) PyModule_New( const char *name /* UTF-8 encoded string */ ); PyAPI_FUNC(PyObject *) PyModule_GetDict(PyObject *); +#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03030000 PyAPI_FUNC(PyObject *) PyModule_GetNameObject(PyObject *); +#endif PyAPI_FUNC(const char *) PyModule_GetName(PyObject *); PyAPI_FUNC(const char *) PyModule_GetFilename(PyObject *) Py_DEPRECATED(3.2); PyAPI_FUNC(PyObject *) PyModule_GetFilenameObject(PyObject *); diff --git a/Include/object.h b/Include/object.h index 338ec1b..63e37b8 100644 --- a/Include/object.h +++ b/Include/object.h @@ -547,7 +547,9 @@ PyAPI_FUNC(PyObject *) _PyObject_NextNotImplemented(PyObject *); PyAPI_FUNC(PyObject *) PyObject_GenericGetAttr(PyObject *, PyObject *); PyAPI_FUNC(int) PyObject_GenericSetAttr(PyObject *, PyObject *, PyObject *); +#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03030000 PyAPI_FUNC(int) PyObject_GenericSetDict(PyObject *, PyObject *, void *); +#endif PyAPI_FUNC(Py_hash_t) PyObject_Hash(PyObject *); PyAPI_FUNC(Py_hash_t) PyObject_HashNotImplemented(PyObject *); PyAPI_FUNC(int) PyObject_IsTrue(PyObject *); diff --git a/Include/objimpl.h b/Include/objimpl.h index c0ed9b7..746f9c9 100644 --- a/Include/objimpl.h +++ b/Include/objimpl.h @@ -95,7 +95,9 @@ PyObject_{New, NewVar, Del}. the raw memory. */ PyAPI_FUNC(void *) PyObject_Malloc(size_t size); +#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03050000 PyAPI_FUNC(void *) PyObject_Calloc(size_t nelem, size_t elsize); +#endif PyAPI_FUNC(void *) PyObject_Realloc(void *ptr, size_t new_size); PyAPI_FUNC(void) PyObject_Free(void *ptr); diff --git a/Include/odictobject.h b/Include/odictobject.h index 9410a0d..ff6ad64 100644 --- a/Include/odictobject.h +++ b/Include/odictobject.h @@ -17,12 +17,13 @@ PyAPI_DATA(PyTypeObject) PyODictKeys_Type; PyAPI_DATA(PyTypeObject) PyODictItems_Type; PyAPI_DATA(PyTypeObject) PyODictValues_Type; -#endif /* Py_LIMITED_API */ - #define PyODict_Check(op) PyObject_TypeCheck(op, &PyODict_Type) #define PyODict_CheckExact(op) (Py_TYPE(op) == &PyODict_Type) #define PyODict_SIZE(op) PyDict_GET_SIZE((op)) -#define PyODict_HasKey(od, key) (PyMapping_HasKey(PyObject *)od, key) + +#endif /* Py_LIMITED_API */ + +#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03050000 PyAPI_FUNC(PyObject *) PyODict_New(void); PyAPI_FUNC(int) PyODict_SetItem(PyObject *od, PyObject *key, PyObject *item); @@ -37,6 +38,8 @@ PyAPI_FUNC(int) PyODict_DelItem(PyObject *od, PyObject *key); #define PyODict_GetItemString(od, key) \ PyDict_GetItemString((PyObject *)od, key) +#endif + #ifdef __cplusplus } #endif diff --git a/Include/osmodule.h b/Include/osmodule.h index 7146757..9095c2f 100644 --- a/Include/osmodule.h +++ b/Include/osmodule.h @@ -7,7 +7,9 @@ extern "C" { #endif +#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03060000 PyAPI_FUNC(PyObject *) PyOS_FSPath(PyObject *path); +#endif #ifdef __cplusplus } diff --git a/Include/pyerrors.h b/Include/pyerrors.h index 3d28a46..4540385 100644 --- a/Include/pyerrors.h +++ b/Include/pyerrors.h @@ -87,8 +87,10 @@ PyAPI_FUNC(PyObject *) PyErr_Occurred(void); PyAPI_FUNC(void) PyErr_Clear(void); PyAPI_FUNC(void) PyErr_Fetch(PyObject **, PyObject **, PyObject **); PyAPI_FUNC(void) PyErr_Restore(PyObject *, PyObject *, PyObject *); +#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03030000 PyAPI_FUNC(void) PyErr_GetExcInfo(PyObject **, PyObject **, PyObject **); PyAPI_FUNC(void) PyErr_SetExcInfo(PyObject *, PyObject *, PyObject *); +#endif #if defined(__clang__) || \ (defined(__GNUC_MAJOR__) && \ @@ -147,7 +149,9 @@ PyAPI_FUNC(void) _PyErr_ChainExceptions(PyObject *, PyObject *, PyObject *); PyAPI_DATA(PyObject *) PyExc_BaseException; PyAPI_DATA(PyObject *) PyExc_Exception; +#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03050000 PyAPI_DATA(PyObject *) PyExc_StopAsyncIteration; +#endif PyAPI_DATA(PyObject *) PyExc_StopIteration; PyAPI_DATA(PyObject *) PyExc_GeneratorExit; PyAPI_DATA(PyObject *) PyExc_ArithmeticError; @@ -160,7 +164,9 @@ PyAPI_DATA(PyObject *) PyExc_EOFError; PyAPI_DATA(PyObject *) PyExc_FloatingPointError; PyAPI_DATA(PyObject *) PyExc_OSError; PyAPI_DATA(PyObject *) PyExc_ImportError; +#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03060000 PyAPI_DATA(PyObject *) PyExc_ModuleNotFoundError; +#endif PyAPI_DATA(PyObject *) PyExc_IndexError; PyAPI_DATA(PyObject *) PyExc_KeyError; PyAPI_DATA(PyObject *) PyExc_KeyboardInterrupt; @@ -168,7 +174,9 @@ PyAPI_DATA(PyObject *) PyExc_MemoryError; PyAPI_DATA(PyObject *) PyExc_NameError; PyAPI_DATA(PyObject *) PyExc_OverflowError; PyAPI_DATA(PyObject *) PyExc_RuntimeError; +#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03050000 PyAPI_DATA(PyObject *) PyExc_RecursionError; +#endif PyAPI_DATA(PyObject *) PyExc_NotImplementedError; PyAPI_DATA(PyObject *) PyExc_SyntaxError; PyAPI_DATA(PyObject *) PyExc_IndentationError; @@ -185,6 +193,7 @@ PyAPI_DATA(PyObject *) PyExc_UnicodeTranslateError; PyAPI_DATA(PyObject *) PyExc_ValueError; PyAPI_DATA(PyObject *) PyExc_ZeroDivisionError; +#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03030000 PyAPI_DATA(PyObject *) PyExc_BlockingIOError; PyAPI_DATA(PyObject *) PyExc_BrokenPipeError; PyAPI_DATA(PyObject *) PyExc_ChildProcessError; @@ -200,6 +209,7 @@ PyAPI_DATA(PyObject *) PyExc_NotADirectoryError; PyAPI_DATA(PyObject *) PyExc_PermissionError; PyAPI_DATA(PyObject *) PyExc_ProcessLookupError; PyAPI_DATA(PyObject *) PyExc_TimeoutError; +#endif /* Compatibility aliases */ @@ -232,8 +242,10 @@ PyAPI_FUNC(PyObject *) PyErr_NoMemory(void); PyAPI_FUNC(PyObject *) PyErr_SetFromErrno(PyObject *); PyAPI_FUNC(PyObject *) PyErr_SetFromErrnoWithFilenameObject( PyObject *, PyObject *); +#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03040000 PyAPI_FUNC(PyObject *) PyErr_SetFromErrnoWithFilenameObjects( PyObject *, PyObject *, PyObject *); +#endif PyAPI_FUNC(PyObject *) PyErr_SetFromErrnoWithFilename( PyObject *exc, const char *filename /* decoded from the filesystem encoding */ @@ -279,8 +291,10 @@ PyAPI_FUNC(PyObject *) PyErr_SetFromWindowsErrWithUnicodeFilename( PyAPI_FUNC(PyObject *) PyErr_SetFromWindowsErr(int); PyAPI_FUNC(PyObject *) PyErr_SetExcFromWindowsErrWithFilenameObject( PyObject *,int, PyObject *); +#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03040000 PyAPI_FUNC(PyObject *) PyErr_SetExcFromWindowsErrWithFilenameObjects( PyObject *,int, PyObject *, PyObject *); +#endif PyAPI_FUNC(PyObject *) PyErr_SetExcFromWindowsErrWithFilename( PyObject *exc, int ierr, @@ -293,13 +307,14 @@ PyAPI_FUNC(PyObject *) PyErr_SetExcFromWindowsErrWithUnicodeFilename( PyAPI_FUNC(PyObject *) PyErr_SetExcFromWindowsErr(PyObject *, int); #endif /* MS_WINDOWS */ -PyAPI_FUNC(PyObject *) PyErr_SetExcWithArgsKwargs(PyObject *, PyObject *, - PyObject *); - +#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03060000 PyAPI_FUNC(PyObject *) PyErr_SetImportErrorSubclass(PyObject *, PyObject *, PyObject *, PyObject *); +#endif +#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03030000 PyAPI_FUNC(PyObject *) PyErr_SetImportError(PyObject *, PyObject *, PyObject *); +#endif /* Export the old function so that the existing API remains available: */ PyAPI_FUNC(void) PyErr_BadInternalCall(void); diff --git a/Include/pymem.h b/Include/pymem.h index ce63bf8..a7eb4d2 100644 --- a/Include/pymem.h +++ b/Include/pymem.h @@ -101,7 +101,9 @@ PyAPI_FUNC(PyObject*) _PyTraceMalloc_GetTraceback( */ PyAPI_FUNC(void *) PyMem_Malloc(size_t size); +#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03050000 PyAPI_FUNC(void *) PyMem_Calloc(size_t nelem, size_t elsize); +#endif PyAPI_FUNC(void *) PyMem_Realloc(void *ptr, size_t new_size); PyAPI_FUNC(void) PyMem_Free(void *ptr); diff --git a/Include/pythonrun.h b/Include/pythonrun.h index cfa0a9f..efc613f 100644 --- a/Include/pythonrun.h +++ b/Include/pythonrun.h @@ -91,9 +91,11 @@ PyAPI_FUNC(struct _mod *) PyParser_ASTFromFileObject( #endif PyAPI_FUNC(struct _node *) PyParser_SimpleParseStringFlags(const char *, int, int); +#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03030000 PyAPI_FUNC(struct _node *) PyParser_SimpleParseStringFlagsFilename(const char *, const char *, int, int); +#endif PyAPI_FUNC(struct _node *) PyParser_SimpleParseFileFlags(FILE *, const char *, int, int); diff --git a/Include/pythread.h b/Include/pythread.h index dd681be..88c4873 100644 --- a/Include/pythread.h +++ b/Include/pythread.h @@ -69,7 +69,9 @@ PyAPI_FUNC(void) PyThread_release_lock(PyThread_type_lock); PyAPI_FUNC(size_t) PyThread_get_stacksize(void); PyAPI_FUNC(int) PyThread_set_stacksize(size_t); +#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03030000 PyAPI_FUNC(PyObject*) PyThread_GetInfo(void); +#endif /* Thread Local Storage (TLS) API */ PyAPI_FUNC(int) PyThread_create_key(void); diff --git a/Include/unicodeobject.h b/Include/unicodeobject.h index 99f2d43..87cd96d 100644 --- a/Include/unicodeobject.h +++ b/Include/unicodeobject.h @@ -722,10 +722,12 @@ PyAPI_FUNC(PyObject*) _PyUnicode_FromASCII( Py_ssize_t size); #endif +#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03030000 PyAPI_FUNC(PyObject*) PyUnicode_Substring( PyObject *str, Py_ssize_t start, Py_ssize_t end); +#endif #ifndef Py_LIMITED_API /* Compute the maximum character of the substring unicode[start:end]. @@ -736,6 +738,7 @@ PyAPI_FUNC(Py_UCS4) _PyUnicode_FindMaxChar ( Py_ssize_t end); #endif +#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03030000 /* Copy the string into a UCS4 buffer including the null character if copy_null is set. Return NULL and raise an exception on error. Raise a SystemError if the buffer is smaller than the string. Return buffer on success. @@ -751,6 +754,7 @@ PyAPI_FUNC(Py_UCS4*) PyUnicode_AsUCS4( * PyMem_Malloc; if this fails, NULL is returned with a memory error exception set. */ PyAPI_FUNC(Py_UCS4*) PyUnicode_AsUCS4Copy(PyObject *unicode); +#endif /* Return a read-only pointer to the Unicode object's internal Py_UNICODE buffer. @@ -775,11 +779,13 @@ PyAPI_FUNC(Py_UNICODE *) PyUnicode_AsUnicodeAndSize( ) /* Py_DEPRECATED(3.3) */; #endif +#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03030000 /* Get the length of the Unicode object. */ PyAPI_FUNC(Py_ssize_t) PyUnicode_GetLength( PyObject *unicode ); +#endif /* Get the number of Py_UNICODE units in the string representation. */ @@ -788,6 +794,7 @@ PyAPI_FUNC(Py_ssize_t) PyUnicode_GetSize( PyObject *unicode /* Unicode object */ ) Py_DEPRECATED(3.3); +#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03030000 /* Read a character from the string. */ PyAPI_FUNC(Py_UCS4) PyUnicode_ReadChar( @@ -805,6 +812,7 @@ PyAPI_FUNC(int) PyUnicode_WriteChar( Py_ssize_t index, Py_UCS4 character ); +#endif #ifndef Py_LIMITED_API /* Get the maximum ordinal for a Unicode character. */ @@ -1490,6 +1498,7 @@ PyAPI_FUNC(PyObject*) PyUnicode_DecodeUnicodeEscape( const char *errors /* error handling */ ); +#ifndef Py_LIMITED_API /* Helper for PyUnicode_DecodeUnicodeEscape that detects invalid escape chars. */ PyAPI_FUNC(PyObject*) _PyUnicode_DecodeUnicodeEscape( @@ -1500,6 +1509,7 @@ PyAPI_FUNC(PyObject*) _PyUnicode_DecodeUnicodeEscape( invalid escaped char in string. */ ); +#endif PyAPI_FUNC(PyObject*) PyUnicode_AsUnicodeEscapeString( PyObject *unicode /* Unicode object */ @@ -1690,6 +1700,7 @@ PyAPI_FUNC(PyObject*) PyUnicode_DecodeMBCSStateful( Py_ssize_t *consumed /* bytes consumed */ ); +#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03030000 PyAPI_FUNC(PyObject*) PyUnicode_DecodeCodePageStateful( int code_page, /* code page number */ const char *string, /* encoded string */ @@ -1697,6 +1708,7 @@ PyAPI_FUNC(PyObject*) PyUnicode_DecodeCodePageStateful( const char *errors, /* error handling */ Py_ssize_t *consumed /* bytes consumed */ ); +#endif PyAPI_FUNC(PyObject*) PyUnicode_AsMBCSString( PyObject *unicode /* Unicode object */ @@ -1710,11 +1722,13 @@ PyAPI_FUNC(PyObject*) PyUnicode_EncodeMBCS( ) Py_DEPRECATED(3.3); #endif +#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03030000 PyAPI_FUNC(PyObject*) PyUnicode_EncodeCodePage( int code_page, /* code page number */ PyObject *unicode, /* Unicode object */ const char *errors /* error handling */ ); +#endif #endif /* MS_WINDOWS */ @@ -1777,6 +1791,7 @@ PyAPI_FUNC(PyObject*) _PyUnicode_TransformDecimalAndSpaceToASCII( /* --- Locale encoding --------------------------------------------------- */ +#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03030000 /* Decode a string from the current locale encoding. The decoder is strict if *surrogateescape* is equal to zero, otherwise it uses the 'surrogateescape' error handler (PEP 383) to escape undecodable bytes. If a byte sequence can @@ -1806,6 +1821,7 @@ PyAPI_FUNC(PyObject*) PyUnicode_EncodeLocale( PyObject *unicode, const char *errors ); +#endif /* --- File system encoding ---------------------------------------------- */ @@ -2002,6 +2018,7 @@ PyAPI_FUNC(Py_ssize_t) PyUnicode_Find( int direction /* Find direction: +1 forward, -1 backward */ ); +#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03030000 /* Like PyUnicode_Find, but search for single character only. */ PyAPI_FUNC(Py_ssize_t) PyUnicode_FindChar( PyObject *str, @@ -2010,6 +2027,7 @@ PyAPI_FUNC(Py_ssize_t) PyUnicode_FindChar( Py_ssize_t end, int direction ); +#endif /* Count the number of occurrences of substr in str[start:end]. */ diff --git a/Include/warnings.h b/Include/warnings.h index c1c6992..a3f83ff 100644 --- a/Include/warnings.h +++ b/Include/warnings.h @@ -18,12 +18,14 @@ PyAPI_FUNC(int) PyErr_WarnFormat( const char *format, /* ASCII-encoded string */ ...); +#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03060000 /* Emit a ResourceWarning warning */ PyAPI_FUNC(int) PyErr_ResourceWarning( PyObject *source, Py_ssize_t stack_level, const char *format, /* ASCII-encoded string */ ...); +#endif #ifndef Py_LIMITED_API PyAPI_FUNC(int) PyErr_WarnExplicitObject( PyObject *category, |