mirror of https://github.com/python/cpython
Issue #1772673: The type of `char*` arguments now changed to `const char*`.
This commit is contained in:
parent
80ab13067e
commit
c679227e31
|
@ -84,7 +84,7 @@ Dictionary Objects
|
||||||
on failure.
|
on failure.
|
||||||
|
|
||||||
|
|
||||||
.. c:function:: int PyDict_DelItemString(PyObject *p, char *key)
|
.. c:function:: int PyDict_DelItemString(PyObject *p, const char *key)
|
||||||
|
|
||||||
Remove the entry in dictionary *p* which has a key specified by the string
|
Remove the entry in dictionary *p* which has a key specified by the string
|
||||||
*key*. Return ``0`` on success or ``-1`` on failure.
|
*key*. Return ``0`` on success or ``-1`` on failure.
|
||||||
|
|
|
@ -17,7 +17,7 @@ error reporting in the interpreter; third-party code is advised to access
|
||||||
the :mod:`io` APIs instead.
|
the :mod:`io` APIs instead.
|
||||||
|
|
||||||
|
|
||||||
.. c:function:: PyFile_FromFd(int fd, char *name, char *mode, int buffering, char *encoding, char *errors, char *newline, int closefd)
|
.. c:function:: PyFile_FromFd(int fd, const char *name, const char *mode, int buffering, const char *encoding, const char *errors, const char *newline, int closefd)
|
||||||
|
|
||||||
Create a Python file object from the file descriptor of an already
|
Create a Python file object from the file descriptor of an already
|
||||||
opened file *fd*. The arguments *name*, *encoding*, *errors* and *newline*
|
opened file *fd*. The arguments *name*, *encoding*, *errors* and *newline*
|
||||||
|
|
|
@ -118,7 +118,7 @@ Importing Modules
|
||||||
encoded string instead of a Unicode object.
|
encoded string instead of a Unicode object.
|
||||||
|
|
||||||
|
|
||||||
.. c:function:: PyObject* PyImport_ExecCodeModule(char *name, PyObject *co)
|
.. c:function:: PyObject* PyImport_ExecCodeModule(const char *name, PyObject *co)
|
||||||
|
|
||||||
.. index:: builtin: compile
|
.. index:: builtin: compile
|
||||||
|
|
||||||
|
@ -145,7 +145,7 @@ Importing Modules
|
||||||
:c:func:`PyImport_ExecCodeModuleWithPathnames`.
|
:c:func:`PyImport_ExecCodeModuleWithPathnames`.
|
||||||
|
|
||||||
|
|
||||||
.. c:function:: PyObject* PyImport_ExecCodeModuleEx(char *name, PyObject *co, char *pathname)
|
.. c:function:: PyObject* PyImport_ExecCodeModuleEx(const char *name, PyObject *co, const char *pathname)
|
||||||
|
|
||||||
Like :c:func:`PyImport_ExecCodeModule`, but the :attr:`__file__` attribute of
|
Like :c:func:`PyImport_ExecCodeModule`, but the :attr:`__file__` attribute of
|
||||||
the module object is set to *pathname* if it is non-``NULL``.
|
the module object is set to *pathname* if it is non-``NULL``.
|
||||||
|
@ -162,7 +162,7 @@ Importing Modules
|
||||||
.. versionadded:: 3.3
|
.. versionadded:: 3.3
|
||||||
|
|
||||||
|
|
||||||
.. c:function:: PyObject* PyImport_ExecCodeModuleWithPathnames(char *name, PyObject *co, char *pathname, char *cpathname)
|
.. c:function:: PyObject* PyImport_ExecCodeModuleWithPathnames(const char *name, PyObject *co, const char *pathname, const char *cpathname)
|
||||||
|
|
||||||
Like :c:func:`PyImport_ExecCodeModuleObject`, but *name*, *pathname* and
|
Like :c:func:`PyImport_ExecCodeModuleObject`, but *name*, *pathname* and
|
||||||
*cpathname* are UTF-8 encoded strings. Attempts are also made to figure out
|
*cpathname* are UTF-8 encoded strings. Attempts are also made to figure out
|
||||||
|
@ -246,7 +246,7 @@ Importing Modules
|
||||||
.. versionadded:: 3.3
|
.. versionadded:: 3.3
|
||||||
|
|
||||||
|
|
||||||
.. c:function:: int PyImport_ImportFrozenModule(char *name)
|
.. c:function:: int PyImport_ImportFrozenModule(const char *name)
|
||||||
|
|
||||||
Similar to :c:func:`PyImport_ImportFrozenModuleObject`, but the name is a
|
Similar to :c:func:`PyImport_ImportFrozenModuleObject`, but the name is a
|
||||||
UTF-8 encoded string instead of a Unicode object.
|
UTF-8 encoded string instead of a Unicode object.
|
||||||
|
|
|
@ -80,7 +80,7 @@ All integers are implemented as "long" integer objects of arbitrary size.
|
||||||
*NULL* on failure.
|
*NULL* on failure.
|
||||||
|
|
||||||
|
|
||||||
.. c:function:: PyObject* PyLong_FromString(char *str, char **pend, int base)
|
.. c:function:: PyObject* PyLong_FromString(const char *str, char **pend, int base)
|
||||||
|
|
||||||
Return a new :c:type:`PyLongObject` based on the string value in *str*, which
|
Return a new :c:type:`PyLongObject` based on the string value in *str*, which
|
||||||
is interpreted according to the radix in *base*. If *pend* is non-*NULL*,
|
is interpreted according to the radix in *base*. If *pend* is non-*NULL*,
|
||||||
|
|
|
@ -22,7 +22,7 @@ Mapping Protocol
|
||||||
expression ``len(o)``.
|
expression ``len(o)``.
|
||||||
|
|
||||||
|
|
||||||
.. c:function:: int PyMapping_DelItemString(PyObject *o, char *key)
|
.. c:function:: int PyMapping_DelItemString(PyObject *o, const char *key)
|
||||||
|
|
||||||
Remove the mapping for object *key* from the object *o*. Return ``-1`` on
|
Remove the mapping for object *key* from the object *o*. Return ``-1`` on
|
||||||
failure. This is equivalent to the Python statement ``del o[key]``.
|
failure. This is equivalent to the Python statement ``del o[key]``.
|
||||||
|
@ -67,13 +67,13 @@ Mapping Protocol
|
||||||
the Python expression ``list(o.items())``.
|
the Python expression ``list(o.items())``.
|
||||||
|
|
||||||
|
|
||||||
.. c:function:: PyObject* PyMapping_GetItemString(PyObject *o, char *key)
|
.. c:function:: PyObject* PyMapping_GetItemString(PyObject *o, const char *key)
|
||||||
|
|
||||||
Return element of *o* corresponding to the object *key* or *NULL* on failure.
|
Return element of *o* corresponding to the object *key* or *NULL* on failure.
|
||||||
This is the equivalent of the Python expression ``o[key]``.
|
This is the equivalent of the Python expression ``o[key]``.
|
||||||
|
|
||||||
|
|
||||||
.. c:function:: int PyMapping_SetItemString(PyObject *o, char *key, PyObject *v)
|
.. c:function:: int PyMapping_SetItemString(PyObject *o, const char *key, PyObject *v)
|
||||||
|
|
||||||
Map the object *key* to the value *v* in object *o*. Returns ``-1`` on failure.
|
Map the object *key* to the value *v* in object *o*. Returns ``-1`` on failure.
|
||||||
This is the equivalent of the Python statement ``o[key] = v``.
|
This is the equivalent of the Python statement ``o[key] = v``.
|
||||||
|
|
|
@ -155,7 +155,7 @@ the same library that the Python runtime is using.
|
||||||
Python source code.
|
Python source code.
|
||||||
|
|
||||||
|
|
||||||
.. c:var:: char* (*PyOS_ReadlineFunctionPointer)(FILE *, FILE *, char *)
|
.. c:var:: char* (*PyOS_ReadlineFunctionPointer)(FILE *, FILE *, const char *)
|
||||||
|
|
||||||
Can be set to point to a function with the prototype
|
Can be set to point to a function with the prototype
|
||||||
``char *func(FILE *stdin, FILE *stdout, char *prompt)``,
|
``char *func(FILE *stdin, FILE *stdout, char *prompt)``,
|
||||||
|
|
|
@ -508,13 +508,13 @@ PyImport_AddModule:const char*:name::
|
||||||
PyImport_Cleanup:void:::
|
PyImport_Cleanup:void:::
|
||||||
|
|
||||||
PyImport_ExecCodeModule:PyObject*::+1:
|
PyImport_ExecCodeModule:PyObject*::+1:
|
||||||
PyImport_ExecCodeModule:char*:name::
|
PyImport_ExecCodeModule:const char*:name::
|
||||||
PyImport_ExecCodeModule:PyObject*:co:0:
|
PyImport_ExecCodeModule:PyObject*:co:0:
|
||||||
|
|
||||||
PyImport_ExecCodeModuleEx:PyObject*::+1:
|
PyImport_ExecCodeModuleEx:PyObject*::+1:
|
||||||
PyImport_ExecCodeModuleEx:char*:name::
|
PyImport_ExecCodeModuleEx:const char*:name::
|
||||||
PyImport_ExecCodeModuleEx:PyObject*:co:0:
|
PyImport_ExecCodeModuleEx:PyObject*:co:0:
|
||||||
PyImport_ExecCodeModuleEx:char*:pathname::
|
PyImport_ExecCodeModuleEx:const char*:pathname::
|
||||||
|
|
||||||
PyImport_GetMagicNumber:long:::
|
PyImport_GetMagicNumber:long:::
|
||||||
|
|
||||||
|
@ -524,7 +524,7 @@ PyImport_Import:PyObject*::+1:
|
||||||
PyImport_Import:PyObject*:name:0:
|
PyImport_Import:PyObject*:name:0:
|
||||||
|
|
||||||
PyImport_ImportFrozenModule:int:::
|
PyImport_ImportFrozenModule:int:::
|
||||||
PyImport_ImportFrozenModule:char*:::
|
PyImport_ImportFrozenModule:const char*:::
|
||||||
|
|
||||||
PyImport_ImportModule:PyObject*::+1:
|
PyImport_ImportModule:PyObject*::+1:
|
||||||
PyImport_ImportModule:const char*:name::
|
PyImport_ImportModule:const char*:name::
|
||||||
|
@ -673,7 +673,7 @@ PyLong_FromUnsignedLongLong:PyObject*::+1:
|
||||||
PyLong_FromUnsignedLongLong:unsigned long long:v::
|
PyLong_FromUnsignedLongLong:unsigned long long:v::
|
||||||
|
|
||||||
PyLong_FromString:PyObject*::+1:
|
PyLong_FromString:PyObject*::+1:
|
||||||
PyLong_FromString:char*:str::
|
PyLong_FromString:const char*:str::
|
||||||
PyLong_FromString:char**:pend::
|
PyLong_FromString:char**:pend::
|
||||||
PyLong_FromString:int:base::
|
PyLong_FromString:int:base::
|
||||||
|
|
||||||
|
@ -701,7 +701,7 @@ PyMapping_DelItemString:const char*:key::
|
||||||
|
|
||||||
PyMapping_GetItemString:PyObject*::+1:
|
PyMapping_GetItemString:PyObject*::+1:
|
||||||
PyMapping_GetItemString:PyObject*:o:0:
|
PyMapping_GetItemString:PyObject*:o:0:
|
||||||
PyMapping_GetItemString:char*:key::
|
PyMapping_GetItemString:const char*:key::
|
||||||
|
|
||||||
PyMapping_HasKey:int:::
|
PyMapping_HasKey:int:::
|
||||||
PyMapping_HasKey:PyObject*:o:0:
|
PyMapping_HasKey:PyObject*:o:0:
|
||||||
|
@ -709,7 +709,7 @@ PyMapping_HasKey:PyObject*:key::
|
||||||
|
|
||||||
PyMapping_HasKeyString:int:::
|
PyMapping_HasKeyString:int:::
|
||||||
PyMapping_HasKeyString:PyObject*:o:0:
|
PyMapping_HasKeyString:PyObject*:o:0:
|
||||||
PyMapping_HasKeyString:char*:key::
|
PyMapping_HasKeyString:const char*:key::
|
||||||
|
|
||||||
PyMapping_Items:PyObject*::+1:
|
PyMapping_Items:PyObject*::+1:
|
||||||
PyMapping_Items:PyObject*:o:0:
|
PyMapping_Items:PyObject*:o:0:
|
||||||
|
@ -722,7 +722,7 @@ PyMapping_Length:PyObject*:o:0:
|
||||||
|
|
||||||
PyMapping_SetItemString:int:::
|
PyMapping_SetItemString:int:::
|
||||||
PyMapping_SetItemString:PyObject*:o:0:
|
PyMapping_SetItemString:PyObject*:o:0:
|
||||||
PyMapping_SetItemString:char*:key::
|
PyMapping_SetItemString:const char*:key::
|
||||||
PyMapping_SetItemString:PyObject*:v:+1:
|
PyMapping_SetItemString:PyObject*:v:+1:
|
||||||
|
|
||||||
PyMapping_Values:PyObject*::+1:
|
PyMapping_Values:PyObject*::+1:
|
||||||
|
@ -735,7 +735,7 @@ PyMarshal_ReadObjectFromFile:PyObject*::+1:
|
||||||
PyMarshal_ReadObjectFromFile:FILE*:file::
|
PyMarshal_ReadObjectFromFile:FILE*:file::
|
||||||
|
|
||||||
PyMarshal_ReadObjectFromString:PyObject*::+1:
|
PyMarshal_ReadObjectFromString:PyObject*::+1:
|
||||||
PyMarshal_ReadObjectFromString:char*:string::
|
PyMarshal_ReadObjectFromString:const char*:string::
|
||||||
PyMarshal_ReadObjectFromString:int:len::
|
PyMarshal_ReadObjectFromString:int:len::
|
||||||
|
|
||||||
PyMarshal_WriteObjectToString:PyObject*::+1:
|
PyMarshal_WriteObjectToString:PyObject*::+1:
|
||||||
|
|
|
@ -144,7 +144,7 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
|
||||||
|
|
||||||
/* Implemented elsewhere:
|
/* Implemented elsewhere:
|
||||||
|
|
||||||
int PyObject_HasAttrString(PyObject *o, char *attr_name);
|
int PyObject_HasAttrString(PyObject *o, const char *attr_name);
|
||||||
|
|
||||||
Returns 1 if o has the attribute attr_name, and 0 otherwise.
|
Returns 1 if o has the attribute attr_name, and 0 otherwise.
|
||||||
This is equivalent to the Python expression:
|
This is equivalent to the Python expression:
|
||||||
|
@ -156,7 +156,7 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
|
||||||
|
|
||||||
/* Implemented elsewhere:
|
/* Implemented elsewhere:
|
||||||
|
|
||||||
PyObject* PyObject_GetAttrString(PyObject *o, char *attr_name);
|
PyObject* PyObject_GetAttrString(PyObject *o, const char *attr_name);
|
||||||
|
|
||||||
Retrieve an attributed named attr_name form object o.
|
Retrieve an attributed named attr_name form object o.
|
||||||
Returns the attribute value on success, or NULL on failure.
|
Returns the attribute value on success, or NULL on failure.
|
||||||
|
@ -189,7 +189,7 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
|
||||||
|
|
||||||
/* Implemented elsewhere:
|
/* Implemented elsewhere:
|
||||||
|
|
||||||
int PyObject_SetAttrString(PyObject *o, char *attr_name, PyObject *v);
|
int PyObject_SetAttrString(PyObject *o, const char *attr_name, PyObject *v);
|
||||||
|
|
||||||
Set the value of the attribute named attr_name, for object o,
|
Set the value of the attribute named attr_name, for object o,
|
||||||
to the value, v. Returns -1 on failure. This is
|
to the value, v. Returns -1 on failure. This is
|
||||||
|
@ -209,7 +209,7 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
|
||||||
|
|
||||||
/* implemented as a macro:
|
/* implemented as a macro:
|
||||||
|
|
||||||
int PyObject_DelAttrString(PyObject *o, char *attr_name);
|
int PyObject_DelAttrString(PyObject *o, const char *attr_name);
|
||||||
|
|
||||||
Delete attribute named attr_name, for object o. Returns
|
Delete attribute named attr_name, for object o. Returns
|
||||||
-1 on failure. This is the equivalent of the Python
|
-1 on failure. This is the equivalent of the Python
|
||||||
|
@ -434,7 +434,7 @@ PyAPI_FUNC(Py_ssize_t) PyObject_LengthHint(PyObject *o, Py_ssize_t);
|
||||||
statement: o[key]=v.
|
statement: o[key]=v.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
PyAPI_FUNC(int) PyObject_DelItemString(PyObject *o, char *key);
|
PyAPI_FUNC(int) PyObject_DelItemString(PyObject *o, const char *key);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Remove the mapping for object, key, from the object *o.
|
Remove the mapping for object, key, from the object *o.
|
||||||
|
@ -1156,7 +1156,7 @@ PyAPI_FUNC(Py_ssize_t) PyObject_LengthHint(PyObject *o, Py_ssize_t);
|
||||||
|
|
||||||
/* implemented as a macro:
|
/* implemented as a macro:
|
||||||
|
|
||||||
int PyMapping_DelItemString(PyObject *o, char *key);
|
int PyMapping_DelItemString(PyObject *o, const char *key);
|
||||||
|
|
||||||
Remove the mapping for object, key, from the object *o.
|
Remove the mapping for object, key, from the object *o.
|
||||||
Returns -1 on failure. This is equivalent to
|
Returns -1 on failure. This is equivalent to
|
||||||
|
@ -1174,7 +1174,7 @@ PyAPI_FUNC(Py_ssize_t) PyObject_LengthHint(PyObject *o, Py_ssize_t);
|
||||||
*/
|
*/
|
||||||
#define PyMapping_DelItem(O,K) PyObject_DelItem((O),(K))
|
#define PyMapping_DelItem(O,K) PyObject_DelItem((O),(K))
|
||||||
|
|
||||||
PyAPI_FUNC(int) PyMapping_HasKeyString(PyObject *o, char *key);
|
PyAPI_FUNC(int) PyMapping_HasKeyString(PyObject *o, const char *key);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
On success, return 1 if the mapping object has the key, key,
|
On success, return 1 if the mapping object has the key, key,
|
||||||
|
@ -1218,7 +1218,8 @@ PyAPI_FUNC(Py_ssize_t) PyObject_LengthHint(PyObject *o, Py_ssize_t);
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
PyAPI_FUNC(PyObject *) PyMapping_GetItemString(PyObject *o, char *key);
|
PyAPI_FUNC(PyObject *) PyMapping_GetItemString(PyObject *o,
|
||||||
|
const char *key);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Return element of o corresponding to the object, key, or NULL
|
Return element of o corresponding to the object, key, or NULL
|
||||||
|
@ -1226,7 +1227,7 @@ PyAPI_FUNC(Py_ssize_t) PyObject_LengthHint(PyObject *o, Py_ssize_t);
|
||||||
o[key].
|
o[key].
|
||||||
*/
|
*/
|
||||||
|
|
||||||
PyAPI_FUNC(int) PyMapping_SetItemString(PyObject *o, char *key,
|
PyAPI_FUNC(int) PyMapping_SetItemString(PyObject *o, const char *key,
|
||||||
PyObject *value);
|
PyObject *value);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -8,8 +8,9 @@ extern "C" {
|
||||||
|
|
||||||
#define PY_STDIOTEXTMODE "b"
|
#define PY_STDIOTEXTMODE "b"
|
||||||
|
|
||||||
PyAPI_FUNC(PyObject *) PyFile_FromFd(int, char *, char *, int, char *, char *,
|
PyAPI_FUNC(PyObject *) PyFile_FromFd(int, const char *, const char *, int,
|
||||||
char *, int);
|
const char *, const char *,
|
||||||
|
const char *, int);
|
||||||
PyAPI_FUNC(PyObject *) PyFile_GetLine(PyObject *, int);
|
PyAPI_FUNC(PyObject *) PyFile_GetLine(PyObject *, int);
|
||||||
PyAPI_FUNC(int) PyFile_WriteObject(PyObject *, PyObject *, int);
|
PyAPI_FUNC(int) PyFile_WriteObject(PyObject *, PyObject *, int);
|
||||||
PyAPI_FUNC(int) PyFile_WriteString(const char *, PyObject *);
|
PyAPI_FUNC(int) PyFile_WriteString(const char *, PyObject *);
|
||||||
|
|
|
@ -69,13 +69,13 @@ typedef struct {
|
||||||
/* FUNCTIONS */
|
/* FUNCTIONS */
|
||||||
|
|
||||||
grammar *newgrammar(int start);
|
grammar *newgrammar(int start);
|
||||||
dfa *adddfa(grammar *g, int type, char *name);
|
dfa *adddfa(grammar *g, int type, const char *name);
|
||||||
int addstate(dfa *d);
|
int addstate(dfa *d);
|
||||||
void addarc(dfa *d, int from, int to, int lbl);
|
void addarc(dfa *d, int from, int to, int lbl);
|
||||||
dfa *PyGrammar_FindDFA(grammar *g, int type);
|
dfa *PyGrammar_FindDFA(grammar *g, int type);
|
||||||
|
|
||||||
int addlabel(labellist *ll, int type, char *str);
|
int addlabel(labellist *ll, int type, const char *str);
|
||||||
int findlabel(labellist *ll, int type, char *str);
|
int findlabel(labellist *ll, int type, const char *str);
|
||||||
const char *PyGrammar_LabelRepr(label *lb);
|
const char *PyGrammar_LabelRepr(label *lb);
|
||||||
void translatelabels(grammar *g);
|
void translatelabels(grammar *g);
|
||||||
|
|
||||||
|
|
|
@ -13,19 +13,19 @@ PyMODINIT_FUNC PyInit_imp(void);
|
||||||
PyAPI_FUNC(long) PyImport_GetMagicNumber(void);
|
PyAPI_FUNC(long) PyImport_GetMagicNumber(void);
|
||||||
PyAPI_FUNC(const char *) PyImport_GetMagicTag(void);
|
PyAPI_FUNC(const char *) PyImport_GetMagicTag(void);
|
||||||
PyAPI_FUNC(PyObject *) PyImport_ExecCodeModule(
|
PyAPI_FUNC(PyObject *) PyImport_ExecCodeModule(
|
||||||
char *name, /* UTF-8 encoded string */
|
const char *name, /* UTF-8 encoded string */
|
||||||
PyObject *co
|
PyObject *co
|
||||||
);
|
);
|
||||||
PyAPI_FUNC(PyObject *) PyImport_ExecCodeModuleEx(
|
PyAPI_FUNC(PyObject *) PyImport_ExecCodeModuleEx(
|
||||||
char *name, /* UTF-8 encoded string */
|
const char *name, /* UTF-8 encoded string */
|
||||||
PyObject *co,
|
PyObject *co,
|
||||||
char *pathname /* decoded from the filesystem encoding */
|
const char *pathname /* decoded from the filesystem encoding */
|
||||||
);
|
);
|
||||||
PyAPI_FUNC(PyObject *) PyImport_ExecCodeModuleWithPathnames(
|
PyAPI_FUNC(PyObject *) PyImport_ExecCodeModuleWithPathnames(
|
||||||
char *name, /* UTF-8 encoded string */
|
const char *name, /* UTF-8 encoded string */
|
||||||
PyObject *co,
|
PyObject *co,
|
||||||
char *pathname, /* decoded from the filesystem encoding */
|
const char *pathname, /* decoded from the filesystem encoding */
|
||||||
char *cpathname /* decoded from the filesystem encoding */
|
const char *cpathname /* decoded from the filesystem encoding */
|
||||||
);
|
);
|
||||||
PyAPI_FUNC(PyObject *) PyImport_ExecCodeModuleObject(
|
PyAPI_FUNC(PyObject *) PyImport_ExecCodeModuleObject(
|
||||||
PyObject *name,
|
PyObject *name,
|
||||||
|
@ -72,7 +72,7 @@ PyAPI_FUNC(int) PyImport_ImportFrozenModuleObject(
|
||||||
PyObject *name
|
PyObject *name
|
||||||
);
|
);
|
||||||
PyAPI_FUNC(int) PyImport_ImportFrozenModule(
|
PyAPI_FUNC(int) PyImport_ImportFrozenModule(
|
||||||
char *name /* UTF-8 encoded string */
|
const char *name /* UTF-8 encoded string */
|
||||||
);
|
);
|
||||||
|
|
||||||
#ifndef Py_LIMITED_API
|
#ifndef Py_LIMITED_API
|
||||||
|
@ -92,12 +92,12 @@ PyAPI_FUNC(PyObject *)_PyImport_FindBuiltin(
|
||||||
PyAPI_FUNC(PyObject *)_PyImport_FindExtensionObject(PyObject *, PyObject *);
|
PyAPI_FUNC(PyObject *)_PyImport_FindExtensionObject(PyObject *, PyObject *);
|
||||||
PyAPI_FUNC(int)_PyImport_FixupBuiltin(
|
PyAPI_FUNC(int)_PyImport_FixupBuiltin(
|
||||||
PyObject *mod,
|
PyObject *mod,
|
||||||
char *name /* UTF-8 encoded string */
|
const char *name /* UTF-8 encoded string */
|
||||||
);
|
);
|
||||||
PyAPI_FUNC(int)_PyImport_FixupExtensionObject(PyObject*, PyObject *, PyObject *);
|
PyAPI_FUNC(int)_PyImport_FixupExtensionObject(PyObject*, PyObject *, PyObject *);
|
||||||
|
|
||||||
struct _inittab {
|
struct _inittab {
|
||||||
char *name; /* ASCII encoded string */
|
const char *name; /* ASCII encoded string */
|
||||||
PyObject* (*initfunc)(void);
|
PyObject* (*initfunc)(void);
|
||||||
};
|
};
|
||||||
PyAPI_DATA(struct _inittab *) PyImport_Inittab;
|
PyAPI_DATA(struct _inittab *) PyImport_Inittab;
|
||||||
|
|
|
@ -93,7 +93,7 @@ PyAPI_FUNC(unsigned PY_LONG_LONG) PyLong_AsUnsignedLongLongMask(PyObject *);
|
||||||
PyAPI_FUNC(PY_LONG_LONG) PyLong_AsLongLongAndOverflow(PyObject *, int *);
|
PyAPI_FUNC(PY_LONG_LONG) PyLong_AsLongLongAndOverflow(PyObject *, int *);
|
||||||
#endif /* HAVE_LONG_LONG */
|
#endif /* HAVE_LONG_LONG */
|
||||||
|
|
||||||
PyAPI_FUNC(PyObject *) PyLong_FromString(char *, char **, int);
|
PyAPI_FUNC(PyObject *) PyLong_FromString(const char *, char **, int);
|
||||||
#ifndef Py_LIMITED_API
|
#ifndef Py_LIMITED_API
|
||||||
PyAPI_FUNC(PyObject *) PyLong_FromUnicode(Py_UNICODE*, Py_ssize_t, int);
|
PyAPI_FUNC(PyObject *) PyLong_FromUnicode(Py_UNICODE*, Py_ssize_t, int);
|
||||||
PyAPI_FUNC(PyObject *) PyLong_FromUnicodeObject(PyObject *u, int base);
|
PyAPI_FUNC(PyObject *) PyLong_FromUnicodeObject(PyObject *u, int base);
|
||||||
|
@ -189,8 +189,8 @@ PyAPI_FUNC(int) _PyLong_FormatAdvancedWriter(
|
||||||
/* These aren't really part of the int object, but they're handy. The
|
/* These aren't really part of the int object, but they're handy. The
|
||||||
functions are in Python/mystrtoul.c.
|
functions are in Python/mystrtoul.c.
|
||||||
*/
|
*/
|
||||||
PyAPI_FUNC(unsigned long) PyOS_strtoul(char *, char **, int);
|
PyAPI_FUNC(unsigned long) PyOS_strtoul(const char *, char **, int);
|
||||||
PyAPI_FUNC(long) PyOS_strtol(char *, char **, int);
|
PyAPI_FUNC(long) PyOS_strtol(const char *, char **, int);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,7 +19,8 @@ PyAPI_FUNC(int) PyMarshal_ReadShortFromFile(FILE *);
|
||||||
PyAPI_FUNC(PyObject *) PyMarshal_ReadObjectFromFile(FILE *);
|
PyAPI_FUNC(PyObject *) PyMarshal_ReadObjectFromFile(FILE *);
|
||||||
PyAPI_FUNC(PyObject *) PyMarshal_ReadLastObjectFromFile(FILE *);
|
PyAPI_FUNC(PyObject *) PyMarshal_ReadLastObjectFromFile(FILE *);
|
||||||
#endif
|
#endif
|
||||||
PyAPI_FUNC(PyObject *) PyMarshal_ReadObjectFromString(char *, Py_ssize_t);
|
PyAPI_FUNC(PyObject *) PyMarshal_ReadObjectFromString(const char *,
|
||||||
|
Py_ssize_t);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,7 +38,8 @@ typedef struct {
|
||||||
PyAPI_FUNC(node *) PyParser_ParseString(const char *, grammar *, int,
|
PyAPI_FUNC(node *) PyParser_ParseString(const char *, grammar *, int,
|
||||||
perrdetail *);
|
perrdetail *);
|
||||||
PyAPI_FUNC(node *) PyParser_ParseFile (FILE *, const char *, grammar *, int,
|
PyAPI_FUNC(node *) PyParser_ParseFile (FILE *, const char *, grammar *, int,
|
||||||
char *, char *, perrdetail *);
|
const char *, const char *,
|
||||||
|
perrdetail *);
|
||||||
|
|
||||||
PyAPI_FUNC(node *) PyParser_ParseStringFlags(const char *, grammar *, int,
|
PyAPI_FUNC(node *) PyParser_ParseStringFlags(const char *, grammar *, int,
|
||||||
perrdetail *, int);
|
perrdetail *, int);
|
||||||
|
@ -48,8 +49,8 @@ PyAPI_FUNC(node *) PyParser_ParseFileFlags(
|
||||||
const char *enc,
|
const char *enc,
|
||||||
grammar *g,
|
grammar *g,
|
||||||
int start,
|
int start,
|
||||||
char *ps1,
|
const char *ps1,
|
||||||
char *ps2,
|
const char *ps2,
|
||||||
perrdetail *err_ret,
|
perrdetail *err_ret,
|
||||||
int flags);
|
int flags);
|
||||||
PyAPI_FUNC(node *) PyParser_ParseFileFlagsEx(
|
PyAPI_FUNC(node *) PyParser_ParseFileFlagsEx(
|
||||||
|
@ -58,8 +59,8 @@ PyAPI_FUNC(node *) PyParser_ParseFileFlagsEx(
|
||||||
const char *enc,
|
const char *enc,
|
||||||
grammar *g,
|
grammar *g,
|
||||||
int start,
|
int start,
|
||||||
char *ps1,
|
const char *ps1,
|
||||||
char *ps2,
|
const char *ps2,
|
||||||
perrdetail *err_ret,
|
perrdetail *err_ret,
|
||||||
int *flags);
|
int *flags);
|
||||||
PyAPI_FUNC(node *) PyParser_ParseFileObject(
|
PyAPI_FUNC(node *) PyParser_ParseFileObject(
|
||||||
|
@ -68,8 +69,8 @@ PyAPI_FUNC(node *) PyParser_ParseFileObject(
|
||||||
const char *enc,
|
const char *enc,
|
||||||
grammar *g,
|
grammar *g,
|
||||||
int start,
|
int start,
|
||||||
char *ps1,
|
const char *ps1,
|
||||||
char *ps2,
|
const char *ps2,
|
||||||
perrdetail *err_ret,
|
perrdetail *err_ret,
|
||||||
int *flags);
|
int *flags);
|
||||||
|
|
||||||
|
|
|
@ -673,8 +673,10 @@ extern char * _getpty(int *, int, mode_t, int);
|
||||||
/* BSDI does not supply a prototype for the 'openpty' and 'forkpty'
|
/* BSDI does not supply a prototype for the 'openpty' and 'forkpty'
|
||||||
functions, even though they are included in libutil. */
|
functions, even though they are included in libutil. */
|
||||||
#include <termios.h>
|
#include <termios.h>
|
||||||
extern int openpty(int *, int *, char *, struct termios *, struct winsize *);
|
extern int openpty(int *, int *, char *,
|
||||||
extern pid_t forkpty(int *, char *, struct termios *, struct winsize *);
|
const struct termios *, const struct winsize *);
|
||||||
|
extern pid_t forkpty(int *, char *,
|
||||||
|
const struct termios *, const struct winsize *);
|
||||||
#endif /* !defined(HAVE_PTY_H) && !defined(HAVE_LIBUTIL_H) */
|
#endif /* !defined(HAVE_PTY_H) && !defined(HAVE_LIBUTIL_H) */
|
||||||
#endif /* defined(HAVE_OPENPTY) || defined(HAVE_FORKPTY) */
|
#endif /* defined(HAVE_OPENPTY) || defined(HAVE_FORKPTY) */
|
||||||
|
|
||||||
|
|
|
@ -261,10 +261,10 @@ PyAPI_DATA(PyThreadState *) _Py_Finalizing;
|
||||||
|
|
||||||
/* Stuff with no proper home (yet) */
|
/* Stuff with no proper home (yet) */
|
||||||
#ifndef Py_LIMITED_API
|
#ifndef Py_LIMITED_API
|
||||||
PyAPI_FUNC(char *) PyOS_Readline(FILE *, FILE *, char *);
|
PyAPI_FUNC(char *) PyOS_Readline(FILE *, FILE *, const char *);
|
||||||
#endif
|
#endif
|
||||||
PyAPI_DATA(int) (*PyOS_InputHook)(void);
|
PyAPI_DATA(int) (*PyOS_InputHook)(void);
|
||||||
PyAPI_DATA(char) *(*PyOS_ReadlineFunctionPointer)(FILE *, FILE *, char *);
|
PyAPI_DATA(char) *(*PyOS_ReadlineFunctionPointer)(FILE *, FILE *, const char *);
|
||||||
#ifndef Py_LIMITED_API
|
#ifndef Py_LIMITED_API
|
||||||
PyAPI_DATA(PyThreadState*) _PyOS_ReadlineTState;
|
PyAPI_DATA(PyThreadState*) _PyOS_ReadlineTState;
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -166,6 +166,8 @@ Library
|
||||||
C API
|
C API
|
||||||
-----
|
-----
|
||||||
|
|
||||||
|
- Issue #1772673: The type of `char*` arguments now changed to `const char*`.
|
||||||
|
|
||||||
- Issue #16129: Added a `Py_SetStandardStreamEncoding` pre-initialization API
|
- Issue #16129: Added a `Py_SetStandardStreamEncoding` pre-initialization API
|
||||||
to allow embedding applications like Blender to force a particular
|
to allow embedding applications like Blender to force a particular
|
||||||
encoding and error handler for the standard IO streams (initial patch by
|
encoding and error handler for the standard IO streams (initial patch by
|
||||||
|
|
|
@ -248,7 +248,7 @@ void pysqlite_statement_bind_parameters(pysqlite_Statement* self, PyObject* para
|
||||||
current_param = PyDict_GetItemString(parameters, binding_name);
|
current_param = PyDict_GetItemString(parameters, binding_name);
|
||||||
Py_XINCREF(current_param);
|
Py_XINCREF(current_param);
|
||||||
} else {
|
} else {
|
||||||
current_param = PyMapping_GetItemString(parameters, (char*)binding_name);
|
current_param = PyMapping_GetItemString(parameters, binding_name);
|
||||||
}
|
}
|
||||||
if (!current_param) {
|
if (!current_param) {
|
||||||
PyErr_Format(pysqlite_ProgrammingError, "You did not supply a value for binding %d.", i);
|
PyErr_Format(pysqlite_ProgrammingError, "You did not supply a value for binding %d.", i);
|
||||||
|
|
|
@ -371,7 +371,7 @@ importmap(const char *modname, const char *symbol,
|
||||||
{
|
{
|
||||||
PyObject *o, *mod;
|
PyObject *o, *mod;
|
||||||
|
|
||||||
mod = PyImport_ImportModule((char *)modname);
|
mod = PyImport_ImportModule(modname);
|
||||||
if (mod == NULL)
|
if (mod == NULL)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
|
|
|
@ -1043,7 +1043,7 @@ rlhandler(char *text)
|
||||||
extern PyThreadState* _PyOS_ReadlineTState;
|
extern PyThreadState* _PyOS_ReadlineTState;
|
||||||
|
|
||||||
static char *
|
static char *
|
||||||
readline_until_enter_or_signal(char *prompt, int *signal)
|
readline_until_enter_or_signal(const char *prompt, int *signal)
|
||||||
{
|
{
|
||||||
char * not_done_reading = "";
|
char * not_done_reading = "";
|
||||||
fd_set selectset;
|
fd_set selectset;
|
||||||
|
@ -1145,7 +1145,7 @@ readline_until_enter_or_signal(char *prompt, int *signal)
|
||||||
|
|
||||||
|
|
||||||
static char *
|
static char *
|
||||||
call_readline(FILE *sys_stdin, FILE *sys_stdout, char *prompt)
|
call_readline(FILE *sys_stdin, FILE *sys_stdout, const char *prompt)
|
||||||
{
|
{
|
||||||
size_t n;
|
size_t n;
|
||||||
char *p, *q;
|
char *p, *q;
|
||||||
|
|
|
@ -223,7 +223,7 @@ PyObject_DelItem(PyObject *o, PyObject *key)
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
PyObject_DelItemString(PyObject *o, char *key)
|
PyObject_DelItemString(PyObject *o, const char *key)
|
||||||
{
|
{
|
||||||
PyObject *okey;
|
PyObject *okey;
|
||||||
int ret;
|
int ret;
|
||||||
|
@ -1950,7 +1950,7 @@ PyMapping_Length(PyObject *o)
|
||||||
#define PyMapping_Length PyMapping_Size
|
#define PyMapping_Length PyMapping_Size
|
||||||
|
|
||||||
PyObject *
|
PyObject *
|
||||||
PyMapping_GetItemString(PyObject *o, char *key)
|
PyMapping_GetItemString(PyObject *o, const char *key)
|
||||||
{
|
{
|
||||||
PyObject *okey, *r;
|
PyObject *okey, *r;
|
||||||
|
|
||||||
|
@ -1966,7 +1966,7 @@ PyMapping_GetItemString(PyObject *o, char *key)
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
PyMapping_SetItemString(PyObject *o, char *key, PyObject *value)
|
PyMapping_SetItemString(PyObject *o, const char *key, PyObject *value)
|
||||||
{
|
{
|
||||||
PyObject *okey;
|
PyObject *okey;
|
||||||
int r;
|
int r;
|
||||||
|
@ -1985,7 +1985,7 @@ PyMapping_SetItemString(PyObject *o, char *key, PyObject *value)
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
PyMapping_HasKeyString(PyObject *o, char *key)
|
PyMapping_HasKeyString(PyObject *o, const char *key)
|
||||||
{
|
{
|
||||||
PyObject *v;
|
PyObject *v;
|
||||||
|
|
||||||
|
|
|
@ -1347,7 +1347,7 @@ do_argstrip(PyBytesObject *self, int striptype, PyObject *args)
|
||||||
{
|
{
|
||||||
PyObject *sep = NULL;
|
PyObject *sep = NULL;
|
||||||
|
|
||||||
if (!PyArg_ParseTuple(args, (char *)stripformat[striptype], &sep))
|
if (!PyArg_ParseTuple(args, stripformat[striptype], &sep))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if (sep != NULL && sep != Py_None) {
|
if (sep != NULL && sep != Py_None) {
|
||||||
|
|
|
@ -121,11 +121,11 @@ BaseException_str(PyBaseExceptionObject *self)
|
||||||
static PyObject *
|
static PyObject *
|
||||||
BaseException_repr(PyBaseExceptionObject *self)
|
BaseException_repr(PyBaseExceptionObject *self)
|
||||||
{
|
{
|
||||||
char *name;
|
const char *name;
|
||||||
char *dot;
|
const char *dot;
|
||||||
|
|
||||||
name = (char *)Py_TYPE(self)->tp_name;
|
name = Py_TYPE(self)->tp_name;
|
||||||
dot = strrchr(name, '.');
|
dot = (const char *) strrchr(name, '.');
|
||||||
if (dot != NULL) name = dot+1;
|
if (dot != NULL) name = dot+1;
|
||||||
|
|
||||||
return PyUnicode_FromFormat("%s%R", name, self->args);
|
return PyUnicode_FromFormat("%s%R", name, self->args);
|
||||||
|
|
|
@ -26,8 +26,8 @@ extern "C" {
|
||||||
/* External C interface */
|
/* External C interface */
|
||||||
|
|
||||||
PyObject *
|
PyObject *
|
||||||
PyFile_FromFd(int fd, char *name, char *mode, int buffering, char *encoding,
|
PyFile_FromFd(int fd, const char *name, const char *mode, int buffering, const char *encoding,
|
||||||
char *errors, char *newline, int closefd)
|
const char *errors, const char *newline, int closefd)
|
||||||
{
|
{
|
||||||
PyObject *io, *stream;
|
PyObject *io, *stream;
|
||||||
_Py_IDENTIFIER(open);
|
_Py_IDENTIFIER(open);
|
||||||
|
|
|
@ -1941,10 +1941,10 @@ unsigned char _PyLong_DigitValue[256] = {
|
||||||
* string characters.
|
* string characters.
|
||||||
*/
|
*/
|
||||||
static PyLongObject *
|
static PyLongObject *
|
||||||
long_from_binary_base(char **str, int base)
|
long_from_binary_base(const char **str, int base)
|
||||||
{
|
{
|
||||||
char *p = *str;
|
const char *p = *str;
|
||||||
char *start = p;
|
const char *start = p;
|
||||||
int bits_per_char;
|
int bits_per_char;
|
||||||
Py_ssize_t n;
|
Py_ssize_t n;
|
||||||
PyLongObject *z;
|
PyLongObject *z;
|
||||||
|
@ -2009,10 +2009,10 @@ long_from_binary_base(char **str, int base)
|
||||||
* If unsuccessful, NULL will be returned.
|
* If unsuccessful, NULL will be returned.
|
||||||
*/
|
*/
|
||||||
PyObject *
|
PyObject *
|
||||||
PyLong_FromString(char *str, char **pend, int base)
|
PyLong_FromString(const char *str, char **pend, int base)
|
||||||
{
|
{
|
||||||
int sign = 1, error_if_nonzero = 0;
|
int sign = 1, error_if_nonzero = 0;
|
||||||
char *start, *orig_str = str;
|
const char *start, *orig_str = str;
|
||||||
PyLongObject *z = NULL;
|
PyLongObject *z = NULL;
|
||||||
PyObject *strobj;
|
PyObject *strobj;
|
||||||
Py_ssize_t slen;
|
Py_ssize_t slen;
|
||||||
|
@ -2147,7 +2147,7 @@ digit beyond the first.
|
||||||
int convwidth;
|
int convwidth;
|
||||||
twodigits convmultmax, convmult;
|
twodigits convmultmax, convmult;
|
||||||
digit *pz, *pzstop;
|
digit *pz, *pzstop;
|
||||||
char* scan;
|
const char* scan;
|
||||||
|
|
||||||
static double log_base_BASE[37] = {0.0e0,};
|
static double log_base_BASE[37] = {0.0e0,};
|
||||||
static int convwidth_base[37] = {0,};
|
static int convwidth_base[37] = {0,};
|
||||||
|
@ -2275,12 +2275,12 @@ digit beyond the first.
|
||||||
if (z == NULL)
|
if (z == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
if (pend != NULL)
|
if (pend != NULL)
|
||||||
*pend = str;
|
*pend = (char *)str;
|
||||||
return (PyObject *) z;
|
return (PyObject *) z;
|
||||||
|
|
||||||
onError:
|
onError:
|
||||||
if (pend != NULL)
|
if (pend != NULL)
|
||||||
*pend = str;
|
*pend = (char *)str;
|
||||||
Py_XDECREF(z);
|
Py_XDECREF(z);
|
||||||
slen = strlen(orig_str) < 200 ? strlen(orig_str) : 200;
|
slen = strlen(orig_str) < 200 ? strlen(orig_str) : 200;
|
||||||
strobj = PyUnicode_FromStringAndSize(orig_str, slen);
|
strobj = PyUnicode_FromStringAndSize(orig_str, slen);
|
||||||
|
|
|
@ -11874,7 +11874,7 @@ do_argstrip(PyObject *self, int striptype, PyObject *args)
|
||||||
{
|
{
|
||||||
PyObject *sep = NULL;
|
PyObject *sep = NULL;
|
||||||
|
|
||||||
if (!PyArg_ParseTuple(args, (char *)stripformat[striptype], &sep))
|
if (!PyArg_ParseTuple(args, stripformat[striptype], &sep))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if (sep != NULL && sep != Py_None) {
|
if (sep != NULL && sep != Py_None) {
|
||||||
|
|
|
@ -29,7 +29,7 @@ newgrammar(int start)
|
||||||
}
|
}
|
||||||
|
|
||||||
dfa *
|
dfa *
|
||||||
adddfa(grammar *g, int type, char *name)
|
adddfa(grammar *g, int type, const char *name)
|
||||||
{
|
{
|
||||||
dfa *d;
|
dfa *d;
|
||||||
|
|
||||||
|
@ -85,7 +85,7 @@ addarc(dfa *d, int from, int to, int lbl)
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
addlabel(labellist *ll, int type, char *str)
|
addlabel(labellist *ll, int type, const char *str)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
label *lb;
|
label *lb;
|
||||||
|
@ -111,7 +111,7 @@ addlabel(labellist *ll, int type, char *str)
|
||||||
/* Same, but rather dies than adds */
|
/* Same, but rather dies than adds */
|
||||||
|
|
||||||
int
|
int
|
||||||
findlabel(labellist *ll, int type, char *str)
|
findlabel(labellist *ll, int type, const char *str)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
|
|
@ -109,7 +109,7 @@ my_fgets(char *buf, int len, FILE *fp)
|
||||||
/* Readline implementation using fgets() */
|
/* Readline implementation using fgets() */
|
||||||
|
|
||||||
char *
|
char *
|
||||||
PyOS_StdioReadline(FILE *sys_stdin, FILE *sys_stdout, char *prompt)
|
PyOS_StdioReadline(FILE *sys_stdin, FILE *sys_stdout, const char *prompt)
|
||||||
{
|
{
|
||||||
size_t n;
|
size_t n;
|
||||||
char *p, *pr;
|
char *p, *pr;
|
||||||
|
@ -170,13 +170,13 @@ PyOS_StdioReadline(FILE *sys_stdin, FILE *sys_stdout, char *prompt)
|
||||||
|
|
||||||
Note: Python expects in return a buffer allocated with PyMem_Malloc. */
|
Note: Python expects in return a buffer allocated with PyMem_Malloc. */
|
||||||
|
|
||||||
char *(*PyOS_ReadlineFunctionPointer)(FILE *, FILE *, char *);
|
char *(*PyOS_ReadlineFunctionPointer)(FILE *, FILE *, const char *);
|
||||||
|
|
||||||
|
|
||||||
/* Interface used by tokenizer.c and bltinmodule.c */
|
/* Interface used by tokenizer.c and bltinmodule.c */
|
||||||
|
|
||||||
char *
|
char *
|
||||||
PyOS_Readline(FILE *sys_stdin, FILE *sys_stdout, char *prompt)
|
PyOS_Readline(FILE *sys_stdin, FILE *sys_stdout, const char *prompt)
|
||||||
{
|
{
|
||||||
char *rv, *res;
|
char *rv, *res;
|
||||||
size_t len;
|
size_t len;
|
||||||
|
|
|
@ -134,13 +134,13 @@ push(stack *s, int type, dfa *d, int newstate, int lineno, int col_offset)
|
||||||
/* PARSER PROPER */
|
/* PARSER PROPER */
|
||||||
|
|
||||||
static int
|
static int
|
||||||
classify(parser_state *ps, int type, char *str)
|
classify(parser_state *ps, int type, const char *str)
|
||||||
{
|
{
|
||||||
grammar *g = ps->p_grammar;
|
grammar *g = ps->p_grammar;
|
||||||
int n = g->g_ll.ll_nlabels;
|
int n = g->g_ll.ll_nlabels;
|
||||||
|
|
||||||
if (type == NAME) {
|
if (type == NAME) {
|
||||||
char *s = str;
|
const char *s = str;
|
||||||
label *l = g->g_ll.ll_label;
|
label *l = g->g_ll.ll_label;
|
||||||
int i;
|
int i;
|
||||||
for (i = n; i > 0; i--, l++) {
|
for (i = n; i > 0; i--, l++) {
|
||||||
|
|
|
@ -94,7 +94,8 @@ PyParser_ParseStringFlagsFilenameEx(const char *s, const char *filename_str,
|
||||||
|
|
||||||
node *
|
node *
|
||||||
PyParser_ParseFile(FILE *fp, const char *filename, grammar *g, int start,
|
PyParser_ParseFile(FILE *fp, const char *filename, grammar *g, int start,
|
||||||
char *ps1, char *ps2, perrdetail *err_ret)
|
const char *ps1, const char *ps2,
|
||||||
|
perrdetail *err_ret)
|
||||||
{
|
{
|
||||||
return PyParser_ParseFileFlags(fp, filename, NULL,
|
return PyParser_ParseFileFlags(fp, filename, NULL,
|
||||||
g, start, ps1, ps2, err_ret, 0);
|
g, start, ps1, ps2, err_ret, 0);
|
||||||
|
@ -103,7 +104,8 @@ PyParser_ParseFile(FILE *fp, const char *filename, grammar *g, int start,
|
||||||
node *
|
node *
|
||||||
PyParser_ParseFileFlags(FILE *fp, const char *filename, const char *enc,
|
PyParser_ParseFileFlags(FILE *fp, const char *filename, const char *enc,
|
||||||
grammar *g, int start,
|
grammar *g, int start,
|
||||||
char *ps1, char *ps2, perrdetail *err_ret, int flags)
|
const char *ps1, const char *ps2,
|
||||||
|
perrdetail *err_ret, int flags)
|
||||||
{
|
{
|
||||||
int iflags = flags;
|
int iflags = flags;
|
||||||
return PyParser_ParseFileFlagsEx(fp, filename, enc, g, start, ps1,
|
return PyParser_ParseFileFlagsEx(fp, filename, enc, g, start, ps1,
|
||||||
|
@ -113,15 +115,15 @@ PyParser_ParseFileFlags(FILE *fp, const char *filename, const char *enc,
|
||||||
node *
|
node *
|
||||||
PyParser_ParseFileObject(FILE *fp, PyObject *filename,
|
PyParser_ParseFileObject(FILE *fp, PyObject *filename,
|
||||||
const char *enc, grammar *g, int start,
|
const char *enc, grammar *g, int start,
|
||||||
char *ps1, char *ps2, perrdetail *err_ret,
|
const char *ps1, const char *ps2,
|
||||||
int *flags)
|
perrdetail *err_ret, int *flags)
|
||||||
{
|
{
|
||||||
struct tok_state *tok;
|
struct tok_state *tok;
|
||||||
|
|
||||||
if (initerr(err_ret, filename) < 0)
|
if (initerr(err_ret, filename) < 0)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if ((tok = PyTokenizer_FromFile(fp, (char *)enc, ps1, ps2)) == NULL) {
|
if ((tok = PyTokenizer_FromFile(fp, enc, ps1, ps2)) == NULL) {
|
||||||
err_ret->error = E_NOMEM;
|
err_ret->error = E_NOMEM;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -135,7 +137,8 @@ PyParser_ParseFileObject(FILE *fp, PyObject *filename,
|
||||||
node *
|
node *
|
||||||
PyParser_ParseFileFlagsEx(FILE *fp, const char *filename,
|
PyParser_ParseFileFlagsEx(FILE *fp, const char *filename,
|
||||||
const char *enc, grammar *g, int start,
|
const char *enc, grammar *g, int start,
|
||||||
char *ps1, char *ps2, perrdetail *err_ret, int *flags)
|
const char *ps1, const char *ps2,
|
||||||
|
perrdetail *err_ret, int *flags)
|
||||||
{
|
{
|
||||||
node *n;
|
node *n;
|
||||||
PyObject *fileobj = NULL;
|
PyObject *fileobj = NULL;
|
||||||
|
|
|
@ -138,7 +138,7 @@ Py_FatalError(const char *msg)
|
||||||
/* No-nonsense my_readline() for tokenizer.c */
|
/* No-nonsense my_readline() for tokenizer.c */
|
||||||
|
|
||||||
char *
|
char *
|
||||||
PyOS_Readline(FILE *sys_stdin, FILE *sys_stdout, char *prompt)
|
PyOS_Readline(FILE *sys_stdin, FILE *sys_stdout, const char *prompt)
|
||||||
{
|
{
|
||||||
size_t n = 1000;
|
size_t n = 1000;
|
||||||
char *p = (char *)PyMem_MALLOC(n);
|
char *p = (char *)PyMem_MALLOC(n);
|
||||||
|
|
|
@ -31,7 +31,7 @@
|
||||||
|| c == '_'\
|
|| c == '_'\
|
||||||
|| (c >= 128))
|
|| (c >= 128))
|
||||||
|
|
||||||
extern char *PyOS_Readline(FILE *, FILE *, char *);
|
extern char *PyOS_Readline(FILE *, FILE *, const char *);
|
||||||
/* Return malloc'ed string including trailing \n;
|
/* Return malloc'ed string including trailing \n;
|
||||||
empty malloc'ed string for EOF;
|
empty malloc'ed string for EOF;
|
||||||
NULL if interrupted */
|
NULL if interrupted */
|
||||||
|
@ -780,7 +780,7 @@ PyTokenizer_FromString(const char *str, int exec_input)
|
||||||
struct tok_state *tok = tok_new();
|
struct tok_state *tok = tok_new();
|
||||||
if (tok == NULL)
|
if (tok == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
str = (char *)decode_str(str, exec_input, tok);
|
str = decode_str(str, exec_input, tok);
|
||||||
if (str == NULL) {
|
if (str == NULL) {
|
||||||
PyTokenizer_Free(tok);
|
PyTokenizer_Free(tok);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -823,7 +823,8 @@ PyTokenizer_FromUTF8(const char *str, int exec_input)
|
||||||
/* Set up tokenizer for file */
|
/* Set up tokenizer for file */
|
||||||
|
|
||||||
struct tok_state *
|
struct tok_state *
|
||||||
PyTokenizer_FromFile(FILE *fp, char* enc, char *ps1, char *ps2)
|
PyTokenizer_FromFile(FILE *fp, const char* enc,
|
||||||
|
const char *ps1, const char *ps2)
|
||||||
{
|
{
|
||||||
struct tok_state *tok = tok_new();
|
struct tok_state *tok = tok_new();
|
||||||
if (tok == NULL)
|
if (tok == NULL)
|
||||||
|
|
|
@ -35,7 +35,7 @@ struct tok_state {
|
||||||
int indstack[MAXINDENT]; /* Stack of indents */
|
int indstack[MAXINDENT]; /* Stack of indents */
|
||||||
int atbol; /* Nonzero if at begin of new line */
|
int atbol; /* Nonzero if at begin of new line */
|
||||||
int pendin; /* Pending indents (if > 0) or dedents (if < 0) */
|
int pendin; /* Pending indents (if > 0) or dedents (if < 0) */
|
||||||
char *prompt, *nextprompt; /* For interactive prompting */
|
const char *prompt, *nextprompt; /* For interactive prompting */
|
||||||
int lineno; /* Current line number */
|
int lineno; /* Current line number */
|
||||||
int level; /* () [] {} Parentheses nesting level */
|
int level; /* () [] {} Parentheses nesting level */
|
||||||
/* Used to allow free continuations inside them */
|
/* Used to allow free continuations inside them */
|
||||||
|
@ -69,8 +69,8 @@ struct tok_state {
|
||||||
|
|
||||||
extern struct tok_state *PyTokenizer_FromString(const char *, int);
|
extern struct tok_state *PyTokenizer_FromString(const char *, int);
|
||||||
extern struct tok_state *PyTokenizer_FromUTF8(const char *, int);
|
extern struct tok_state *PyTokenizer_FromUTF8(const char *, int);
|
||||||
extern struct tok_state *PyTokenizer_FromFile(FILE *, char*,
|
extern struct tok_state *PyTokenizer_FromFile(FILE *, const char*,
|
||||||
char *, char *);
|
const char *, const char *);
|
||||||
extern void PyTokenizer_Free(struct tok_state *);
|
extern void PyTokenizer_Free(struct tok_state *);
|
||||||
extern int PyTokenizer_Get(struct tok_state *, char **, char **);
|
extern int PyTokenizer_Get(struct tok_state *, char **, char **);
|
||||||
extern char * PyTokenizer_RestoreEncoding(struct tok_state* tok,
|
extern char * PyTokenizer_RestoreEncoding(struct tok_state* tok,
|
||||||
|
|
14
Python/ast.c
14
Python/ast.c
|
@ -3651,18 +3651,16 @@ parsenumber(struct compiling *c, const char *s)
|
||||||
end = s + strlen(s) - 1;
|
end = s + strlen(s) - 1;
|
||||||
imflag = *end == 'j' || *end == 'J';
|
imflag = *end == 'j' || *end == 'J';
|
||||||
if (s[0] == '0') {
|
if (s[0] == '0') {
|
||||||
x = (long) PyOS_strtoul((char *)s, (char **)&end, 0);
|
x = (long) PyOS_strtoul(s, (char **)&end, 0);
|
||||||
if (x < 0 && errno == 0) {
|
if (x < 0 && errno == 0) {
|
||||||
return PyLong_FromString((char *)s,
|
return PyLong_FromString(s, (char **)0, 0);
|
||||||
(char **)0,
|
|
||||||
0);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
x = PyOS_strtol((char *)s, (char **)&end, 0);
|
x = PyOS_strtol(s, (char **)&end, 0);
|
||||||
if (*end == '\0') {
|
if (*end == '\0') {
|
||||||
if (errno != 0)
|
if (errno != 0)
|
||||||
return PyLong_FromString((char *)s, (char **)0, 0);
|
return PyLong_FromString(s, (char **)0, 0);
|
||||||
return PyLong_FromLong(x);
|
return PyLong_FromLong(x);
|
||||||
}
|
}
|
||||||
/* XXX Huge floats may silently fail */
|
/* XXX Huge floats may silently fail */
|
||||||
|
@ -3685,8 +3683,8 @@ parsenumber(struct compiling *c, const char *s)
|
||||||
static PyObject *
|
static PyObject *
|
||||||
decode_utf8(struct compiling *c, const char **sPtr, const char *end)
|
decode_utf8(struct compiling *c, const char **sPtr, const char *end)
|
||||||
{
|
{
|
||||||
char *s, *t;
|
const char *s, *t;
|
||||||
t = s = (char *)*sPtr;
|
t = s = *sPtr;
|
||||||
/* while (s < end && *s != '\\') s++; */ /* inefficient for u".." */
|
/* while (s < end && *s != '\\') s++; */ /* inefficient for u".." */
|
||||||
while (s < end && (*s & 0x80)) s++;
|
while (s < end && (*s & 0x80)) s++;
|
||||||
*sPtr = s;
|
*sPtr = s;
|
||||||
|
|
|
@ -1335,7 +1335,7 @@ min_max(PyObject *args, PyObject *kwds, int op)
|
||||||
|
|
||||||
if (positional)
|
if (positional)
|
||||||
v = args;
|
v = args;
|
||||||
else if (!PyArg_UnpackTuple(args, (char *)name, 1, 1, &v))
|
else if (!PyArg_UnpackTuple(args, name, 1, 1, &v))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
emptytuple = PyTuple_New(0);
|
emptytuple = PyTuple_New(0);
|
||||||
|
|
|
@ -441,7 +441,7 @@ int PyCodec_RegisterError(const char *name, PyObject *error)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
return PyDict_SetItemString(interp->codec_error_registry,
|
return PyDict_SetItemString(interp->codec_error_registry,
|
||||||
(char *)name, error);
|
name, error);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Lookup the error handling callback function registered under the
|
/* Lookup the error handling callback function registered under the
|
||||||
|
@ -457,7 +457,7 @@ PyObject *PyCodec_LookupError(const char *name)
|
||||||
|
|
||||||
if (name==NULL)
|
if (name==NULL)
|
||||||
name = "strict";
|
name = "strict";
|
||||||
handler = PyDict_GetItemString(interp->codec_error_registry, (char *)name);
|
handler = PyDict_GetItemString(interp->codec_error_registry, name);
|
||||||
if (!handler)
|
if (!handler)
|
||||||
PyErr_Format(PyExc_LookupError, "unknown error handler name '%.400s'", name);
|
PyErr_Format(PyExc_LookupError, "unknown error handler name '%.400s'", name);
|
||||||
else
|
else
|
||||||
|
|
|
@ -517,7 +517,7 @@ _PyImport_FixupExtensionObject(PyObject *mod, PyObject *name,
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
_PyImport_FixupBuiltin(PyObject *mod, char *name)
|
_PyImport_FixupBuiltin(PyObject *mod, const char *name)
|
||||||
{
|
{
|
||||||
int res;
|
int res;
|
||||||
PyObject *nameobj;
|
PyObject *nameobj;
|
||||||
|
@ -656,22 +656,23 @@ remove_module(PyObject *name)
|
||||||
* interface. The other two exist primarily for backward compatibility.
|
* interface. The other two exist primarily for backward compatibility.
|
||||||
*/
|
*/
|
||||||
PyObject *
|
PyObject *
|
||||||
PyImport_ExecCodeModule(char *name, PyObject *co)
|
PyImport_ExecCodeModule(const char *name, PyObject *co)
|
||||||
{
|
{
|
||||||
return PyImport_ExecCodeModuleWithPathnames(
|
return PyImport_ExecCodeModuleWithPathnames(
|
||||||
name, co, (char *)NULL, (char *)NULL);
|
name, co, (char *)NULL, (char *)NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
PyObject *
|
PyObject *
|
||||||
PyImport_ExecCodeModuleEx(char *name, PyObject *co, char *pathname)
|
PyImport_ExecCodeModuleEx(const char *name, PyObject *co, const char *pathname)
|
||||||
{
|
{
|
||||||
return PyImport_ExecCodeModuleWithPathnames(
|
return PyImport_ExecCodeModuleWithPathnames(
|
||||||
name, co, pathname, (char *)NULL);
|
name, co, pathname, (char *)NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
PyObject *
|
PyObject *
|
||||||
PyImport_ExecCodeModuleWithPathnames(char *name, PyObject *co, char *pathname,
|
PyImport_ExecCodeModuleWithPathnames(const char *name, PyObject *co,
|
||||||
char *cpathname)
|
const char *pathname,
|
||||||
|
const char *cpathname)
|
||||||
{
|
{
|
||||||
PyObject *m = NULL;
|
PyObject *m = NULL;
|
||||||
PyObject *nameobj, *pathobj = NULL, *cpathobj = NULL;
|
PyObject *nameobj, *pathobj = NULL, *cpathobj = NULL;
|
||||||
|
@ -1019,7 +1020,7 @@ get_frozen_object(PyObject *name)
|
||||||
size = p->size;
|
size = p->size;
|
||||||
if (size < 0)
|
if (size < 0)
|
||||||
size = -size;
|
size = -size;
|
||||||
return PyMarshal_ReadObjectFromString((char *)p->code, size);
|
return PyMarshal_ReadObjectFromString((const char *)p->code, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
|
@ -1071,7 +1072,7 @@ PyImport_ImportFrozenModuleObject(PyObject *name)
|
||||||
ispackage = (size < 0);
|
ispackage = (size < 0);
|
||||||
if (ispackage)
|
if (ispackage)
|
||||||
size = -size;
|
size = -size;
|
||||||
co = PyMarshal_ReadObjectFromString((char *)p->code, size);
|
co = PyMarshal_ReadObjectFromString((const char *)p->code, size);
|
||||||
if (co == NULL)
|
if (co == NULL)
|
||||||
return -1;
|
return -1;
|
||||||
if (!PyCode_Check(co)) {
|
if (!PyCode_Check(co)) {
|
||||||
|
@ -1113,7 +1114,7 @@ err_return:
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
PyImport_ImportFrozenModule(char *name)
|
PyImport_ImportFrozenModule(const char *name)
|
||||||
{
|
{
|
||||||
PyObject *nameobj;
|
PyObject *nameobj;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
|
@ -1466,15 +1466,15 @@ PyMarshal_ReadObjectFromFile(FILE *fp)
|
||||||
}
|
}
|
||||||
|
|
||||||
PyObject *
|
PyObject *
|
||||||
PyMarshal_ReadObjectFromString(char *str, Py_ssize_t len)
|
PyMarshal_ReadObjectFromString(const char *str, Py_ssize_t len)
|
||||||
{
|
{
|
||||||
RFILE rf;
|
RFILE rf;
|
||||||
PyObject *result;
|
PyObject *result;
|
||||||
rf.fp = NULL;
|
rf.fp = NULL;
|
||||||
rf.readable = NULL;
|
rf.readable = NULL;
|
||||||
rf.current_filename = NULL;
|
rf.current_filename = NULL;
|
||||||
rf.ptr = str;
|
rf.ptr = (char *)str;
|
||||||
rf.end = str + len;
|
rf.end = (char *)str + len;
|
||||||
rf.buf = NULL;
|
rf.buf = NULL;
|
||||||
rf.depth = 0;
|
rf.depth = 0;
|
||||||
rf.refs = PyList_New(0);
|
rf.refs = PyList_New(0);
|
||||||
|
|
|
@ -92,7 +92,7 @@ static int digitlimit[] = {
|
||||||
** exceptions - we don't check for them.
|
** exceptions - we don't check for them.
|
||||||
*/
|
*/
|
||||||
unsigned long
|
unsigned long
|
||||||
PyOS_strtoul(char *str, char **ptr, int base)
|
PyOS_strtoul(const char *str, char **ptr, int base)
|
||||||
{
|
{
|
||||||
unsigned long result = 0; /* return value of the function */
|
unsigned long result = 0; /* return value of the function */
|
||||||
int c; /* current input character */
|
int c; /* current input character */
|
||||||
|
@ -111,7 +111,7 @@ PyOS_strtoul(char *str, char **ptr, int base)
|
||||||
/* there must be at least one digit after 0x */
|
/* there must be at least one digit after 0x */
|
||||||
if (_PyLong_DigitValue[Py_CHARMASK(str[1])] >= 16) {
|
if (_PyLong_DigitValue[Py_CHARMASK(str[1])] >= 16) {
|
||||||
if (ptr)
|
if (ptr)
|
||||||
*ptr = str;
|
*ptr = (char *)str;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
++str;
|
++str;
|
||||||
|
@ -120,7 +120,7 @@ PyOS_strtoul(char *str, char **ptr, int base)
|
||||||
/* there must be at least one digit after 0o */
|
/* there must be at least one digit after 0o */
|
||||||
if (_PyLong_DigitValue[Py_CHARMASK(str[1])] >= 8) {
|
if (_PyLong_DigitValue[Py_CHARMASK(str[1])] >= 8) {
|
||||||
if (ptr)
|
if (ptr)
|
||||||
*ptr = str;
|
*ptr = (char *)str;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
++str;
|
++str;
|
||||||
|
@ -129,7 +129,7 @@ PyOS_strtoul(char *str, char **ptr, int base)
|
||||||
/* there must be at least one digit after 0b */
|
/* there must be at least one digit after 0b */
|
||||||
if (_PyLong_DigitValue[Py_CHARMASK(str[1])] >= 2) {
|
if (_PyLong_DigitValue[Py_CHARMASK(str[1])] >= 2) {
|
||||||
if (ptr)
|
if (ptr)
|
||||||
*ptr = str;
|
*ptr = (char *)str;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
++str;
|
++str;
|
||||||
|
@ -141,7 +141,7 @@ PyOS_strtoul(char *str, char **ptr, int base)
|
||||||
while (Py_ISSPACE(Py_CHARMASK(*str)))
|
while (Py_ISSPACE(Py_CHARMASK(*str)))
|
||||||
++str;
|
++str;
|
||||||
if (ptr)
|
if (ptr)
|
||||||
*ptr = str;
|
*ptr = (char *)str;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -157,7 +157,7 @@ PyOS_strtoul(char *str, char **ptr, int base)
|
||||||
/* there must be at least one digit after 0x */
|
/* there must be at least one digit after 0x */
|
||||||
if (_PyLong_DigitValue[Py_CHARMASK(str[1])] >= 16) {
|
if (_PyLong_DigitValue[Py_CHARMASK(str[1])] >= 16) {
|
||||||
if (ptr)
|
if (ptr)
|
||||||
*ptr = str;
|
*ptr = (char *)str;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
++str;
|
++str;
|
||||||
|
@ -171,7 +171,7 @@ PyOS_strtoul(char *str, char **ptr, int base)
|
||||||
/* there must be at least one digit after 0o */
|
/* there must be at least one digit after 0o */
|
||||||
if (_PyLong_DigitValue[Py_CHARMASK(str[1])] >= 8) {
|
if (_PyLong_DigitValue[Py_CHARMASK(str[1])] >= 8) {
|
||||||
if (ptr)
|
if (ptr)
|
||||||
*ptr = str;
|
*ptr = (char *)str;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
++str;
|
++str;
|
||||||
|
@ -185,7 +185,7 @@ PyOS_strtoul(char *str, char **ptr, int base)
|
||||||
/* there must be at least one digit after 0b */
|
/* there must be at least one digit after 0b */
|
||||||
if (_PyLong_DigitValue[Py_CHARMASK(str[1])] >= 2) {
|
if (_PyLong_DigitValue[Py_CHARMASK(str[1])] >= 2) {
|
||||||
if (ptr)
|
if (ptr)
|
||||||
*ptr = str;
|
*ptr = (char *)str;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
++str;
|
++str;
|
||||||
|
@ -197,7 +197,7 @@ PyOS_strtoul(char *str, char **ptr, int base)
|
||||||
/* catch silly bases */
|
/* catch silly bases */
|
||||||
if (base < 2 || base > 36) {
|
if (base < 2 || base > 36) {
|
||||||
if (ptr)
|
if (ptr)
|
||||||
*ptr = str;
|
*ptr = (char *)str;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -239,7 +239,7 @@ PyOS_strtoul(char *str, char **ptr, int base)
|
||||||
|
|
||||||
/* set pointer to point to the last character scanned */
|
/* set pointer to point to the last character scanned */
|
||||||
if (ptr)
|
if (ptr)
|
||||||
*ptr = str;
|
*ptr = (char *)str;
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
|
||||||
|
@ -248,7 +248,7 @@ overflowed:
|
||||||
/* spool through remaining digit characters */
|
/* spool through remaining digit characters */
|
||||||
while (_PyLong_DigitValue[Py_CHARMASK(*str)] < base)
|
while (_PyLong_DigitValue[Py_CHARMASK(*str)] < base)
|
||||||
++str;
|
++str;
|
||||||
*ptr = str;
|
*ptr = (char *)str;
|
||||||
}
|
}
|
||||||
errno = ERANGE;
|
errno = ERANGE;
|
||||||
return (unsigned long)-1;
|
return (unsigned long)-1;
|
||||||
|
@ -260,7 +260,7 @@ overflowed:
|
||||||
#define PY_ABS_LONG_MIN (0-(unsigned long)LONG_MIN)
|
#define PY_ABS_LONG_MIN (0-(unsigned long)LONG_MIN)
|
||||||
|
|
||||||
long
|
long
|
||||||
PyOS_strtol(char *str, char **ptr, int base)
|
PyOS_strtol(const char *str, char **ptr, int base)
|
||||||
{
|
{
|
||||||
long result;
|
long result;
|
||||||
unsigned long uresult;
|
unsigned long uresult;
|
||||||
|
|
Loading…
Reference in New Issue