Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
b037c554
Commit
b037c554
authored
Nov 09, 1999
by
Fred Drake
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use \citetitle and \programopt as appropriate.
parent
f4d3ef71
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
17 deletions
+18
-17
Doc/api/api.tex
Doc/api/api.tex
+18
-17
No files found.
Doc/api/api.tex
View file @
b037c554
...
...
@@ -22,9 +22,9 @@
\noindent
This manual documents the API used by
\C
{}
(or
\Cpp
{}
) programmers who
want to write extension modules or embed Python. It is a companion to
\
emph
{
Extending and Embedding the Python Interpreter
}
, which describes
the general principles of extension writing but does not document the
API functions in detail.
\
citetitle
[../ext/ext.html]
{
Extending and Embedding the Python
Interpreter
}
, which describes the general principles of extension
writing but does not document the
API functions in detail.
\strong
{
Warning:
}
The current version of this document is incomplete.
I hope that it is nevertheless useful. I will continue to work on it,
...
...
@@ -109,10 +109,11 @@ be declared.
All Python objects (even Python integers) have a
\dfn
{
type
}
and a
\dfn
{
reference count
}
. An object's type determines what kind of object
it is (e.g., an integer, a list, or a user-defined function; there are
many more as explained in the
\emph
{
Python Reference Manual
}
). For
each of the well-known types there is a macro to check whether an
object is of that type; for instance,
\samp
{
PyList
_
Check(
\var
{
a
}
)
}
is
true iff the object pointed to by
\var
{
a
}
is a Python list.
many more as explained in the
\citetitle
[../ref/ref.html]
{
Python
Reference Manual
}
). For each of the well-known types there is a macro
to check whether an object is of that type; for instance,
\samp
{
PyList
_
Check(
\var
{
a
}
)
}
is true if and only if the object pointed
to by
\var
{
a
}
is a Python list.
\subsection
{
Reference Counts
\label
{
refcounts
}}
...
...
@@ -873,11 +874,11 @@ This utility function creates and returns a new exception object. The
of the form
\code
{
module.class
}
. The
\var
{
base
}
and
\var
{
dict
}
arguments are normally
\NULL
{}
. Normally, this creates a class
object derived from the root for all exceptions, the built-in name
\exception
{
Exception
}
(accessible in
\C
{}
as
\cdata
{
PyExc
_
Exception
}
).
\exception
{
Exception
}
(accessible in
C
as
\cdata
{
PyExc
_
Exception
}
).
In this case the
\member
{__
module
__}
attribute of the new class is set to the
first part (up to the last dot) of the
\var
{
name
}
argument, and the
class name is set to the last part (after the last dot). When the
user has specified the
\
code
{
-X
}
command line option to use string
user has specified the
\
programopt
{
-X
}
command line option to use string
exceptions, for backward compatibility, or when the
\var
{
base
}
argument is not a class object (and not
\NULL
{}
), a string object
created from the entire
\var
{
name
}
argument is returned. The
...
...
@@ -890,11 +891,10 @@ variables and methods.
\section
{
Standard Exceptions
\label
{
standardExceptions
}}
All standard Python exceptions are available as global variables whose
names are
\samp
{
PyExc
_}
followed by the Python exception name.
These have the type
\ctype
{
PyObject *
}
; they are all either class
objects or string objects, depending on the use of the
\code
{
-X
}
option to the interpreter. For completeness, here are all the
variables:
names are
\samp
{
PyExc
_}
followed by the Python exception name. These
have the type
\ctype
{
PyObject *
}
; they are all either class objects or
string objects, depending on the use of the
\programopt
{
-X
}
option to the
interpreter. For completeness, here are all the variables:
\cdata
{
PyExc
_
Exception
}
,
\cdata
{
PyExc
_
StandardError
}
,
\cdata
{
PyExc
_
ArithmeticError
}
,
...
...
@@ -2126,19 +2126,20 @@ specified as a \ctype{char *}, rather than a \ctype{PyObject *}.
\begin{cfuncdesc}
{
PyObject*
}{
PyDict
_
Items
}{
PyDictObject *p
}
Returns a
\ctype
{
PyListObject
}
containing all the items
from the dictionary, as in the dictinoary method
\method
{
items()
}
(see
the
\
emph
{
Python Library Reference
}
).
the
\
citetitle
[../lib/lib.html]
{
Python Library Reference
}
).
\end{cfuncdesc}
\begin{cfuncdesc}
{
PyObject*
}{
PyDict
_
Keys
}{
PyDictObject *p
}
Returns a
\ctype
{
PyListObject
}
containing all the keys
from the dictionary, as in the dictionary method
\method
{
keys()
}
(see the
\
emph
{
Python Library Reference
}
).
\
citetitle
[../lib/lib.html]
{
Python Library Reference
}
).
\end{cfuncdesc}
\begin{cfuncdesc}
{
PyObject*
}{
PyDict
_
Values
}{
PyDictObject *p
}
Returns a
\ctype
{
PyListObject
}
containing all the values
from the dictionary
\var
{
p
}
, as in the dictionary method
\method
{
values()
}
(see the
\emph
{
Python Library Reference
}
).
\method
{
values()
}
(see the
\citetitle
[../lib/lib.html]
{
Python Library
Reference
}
).
\end{cfuncdesc}
\begin{cfuncdesc}
{
int
}{
PyDict
_
Size
}{
PyDictObject *p
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment