Skip to content

Commit 0813168

Browse files
committed
Issue #14090: fix some minor C API problems in default branch (3.3)
1 parent 11cfea9 commit 0813168

File tree

8 files changed

+15
-17
lines changed

8 files changed

+15
-17
lines changed

Doc/c-api/code.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,19 +31,19 @@ bound into a function.
3131
3232
Return true if *co* is a :class:`code` object
3333
34-
.. c:function:: int PyCode_GetNumFree(PyObject *co)
34+
.. c:function:: int PyCode_GetNumFree(PyCodeObject *co)
3535
3636
Return the number of free variables in *co*.
3737
38-
.. c:function:: PyCodeObject *PyCode_New(int argcount, int kwonlyargcount, int nlocals, int stacksize, int flags, PyObject *code, PyObject *consts, PyObject *names, PyObject *varnames, PyObject *freevars, PyObject *cellvars, PyObject *filename, PyObject *name, int firstlineno, PyObject *lnotab)
38+
.. c:function:: PyCodeObject* PyCode_New(int argcount, int kwonlyargcount, int nlocals, int stacksize, int flags, PyObject *code, PyObject *consts, PyObject *names, PyObject *varnames, PyObject *freevars, PyObject *cellvars, PyObject *filename, PyObject *name, int firstlineno, PyObject *lnotab)
3939
4040
Return a new code object. If you need a dummy code object to
4141
create a frame, use :c:func:`PyCode_NewEmpty` instead. Calling
4242
:c:func:`PyCode_New` directly can bind you to a precise Python
4343
version since the definition of the bytecode changes often.
4444
4545
46-
.. c:function:: int PyCode_NewEmpty(const char *filename, const char *funcname, int firstlineno)
46+
.. c:function:: PyCodeObject* PyCode_NewEmpty(const char *filename, const char *funcname, int firstlineno)
4747
4848
Return a new empty code object with the specified filename,
4949
function name, and first line number. It is illegal to

Doc/c-api/conversion.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,13 +119,13 @@ The following functions provide locale-independent string to number conversions.
119119
.. versionadded:: 3.1
120120
121121
122-
.. c:function:: char* PyOS_stricmp(char *s1, char *s2)
122+
.. c:function:: int PyOS_stricmp(char *s1, char *s2)
123123
124124
Case insensitive comparison of strings. The function works almost
125125
identically to :c:func:`strcmp` except that it ignores the case.
126126
127127
128-
.. c:function:: char* PyOS_strnicmp(char *s1, char *s2, Py_ssize_t size)
128+
.. c:function:: int PyOS_strnicmp(char *s1, char *s2, Py_ssize_t size)
129129
130130
Case insensitive comparison of strings. The function works almost
131131
identically to :c:func:`strncmp` except that it ignores the case.

Doc/c-api/init.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -646,7 +646,7 @@ with sub-interpreters:
646646
:c:func:`PyGILState_Release` on the same thread.
647647
648648
649-
.. c:function:: PyThreadState PyGILState_GetThisThreadState()
649+
.. c:function:: PyThreadState* PyGILState_GetThisThreadState()
650650
651651
Get the current thread state for this thread. May return ``NULL`` if no
652652
GILState API has been used on the current thread. Note that the main thread

Doc/c-api/type.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,13 +51,13 @@ Type Objects
5151
modification of the attributes or base classes of the type.
5252
5353
54-
.. c:function:: int PyType_HasFeature(PyObject *o, int feature)
54+
.. c:function:: int PyType_HasFeature(PyTypeObject *o, int feature)
5555
5656
Return true if the type object *o* sets the feature *feature*. Type features
5757
are denoted by single bit flags.
5858
5959
60-
.. c:function:: int PyType_IS_GC(PyObject *o)
60+
.. c:function:: int PyType_IS_GC(PyTypeObject *o)
6161
6262
Return true if the type object includes support for the cycle detector; this
6363
tests the type flag :const:`Py_TPFLAGS_HAVE_GC`.

Doc/c-api/unicode.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1615,7 +1615,7 @@ They all return *NULL* or ``-1`` if an exception occurs.
16151615
ISO-8859-1 if it contains non-ASCII characters".
16161616
16171617
1618-
.. c:function:: int PyUnicode_RichCompare(PyObject *left, PyObject *right, int op)
1618+
.. c:function:: PyObject* PyUnicode_RichCompare(PyObject *left, PyObject *right, int op)
16191619
16201620
Rich compare two unicode strings and return one of the following:
16211621

Doc/c-api/veryhigh.rst

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -95,12 +95,6 @@ the same library that the Python runtime is using.
9595
leaving *closeit* set to ``0`` and *flags* set to *NULL*.
9696
9797
98-
.. c:function:: int PyRun_SimpleFileFlags(FILE *fp, const char *filename, PyCompilerFlags *flags)
99-
100-
This is a simplified interface to :c:func:`PyRun_SimpleFileExFlags` below,
101-
leaving *closeit* set to ``0``.
102-
103-
10498
.. c:function:: int PyRun_SimpleFileEx(FILE *fp, const char *filename, int closeit)
10599
106100
This is a simplified interface to :c:func:`PyRun_SimpleFileExFlags` below,

Include/pythonrun.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,12 @@ PyAPI_FUNC(struct _mod *) PyParser_ASTFromFile(
8282
PyParser_SimpleParseFileFlags(FP, S, B, 0)
8383
#endif
8484
PyAPI_FUNC(struct _node *) PyParser_SimpleParseStringFlags(const char *, int,
85-
int);
85+
int);
86+
PyAPI_FUNC(struct _node *) PyParser_SimpleParseStringFlagsFilename(const char *,
87+
const char *,
88+
int, int);
8689
PyAPI_FUNC(struct _node *) PyParser_SimpleParseFileFlags(FILE *, const char *,
87-
int, int);
90+
int, int);
8891

8992
#ifndef Py_LIMITED_API
9093
PyAPI_FUNC(PyObject *) PyRun_StringFlags(const char *, int, PyObject *,

Misc/ACKS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -989,6 +989,7 @@ Frank Stajano
989989
Joel Stanley
990990
Oliver Steele
991991
Greg Stein
992+
Baruch Sterin
992993
Chris Stern
993994
Alex Stewart
994995
Victor Stinner

0 commit comments

Comments
 (0)