Mercurial > cpython-lru_cache-weakref
annotate Doc/api/api.tex @ 5792:dffabc620e4e legacy-trunk
Tweak re_tests and test_re to differentiate between
groups that have no value and groups that are out of bounds.
| author | Guido van Rossum <guido@python.org> |
|---|---|
| date | Tue, 15 Jul 1997 15:49:52 +0000 |
| parents | 53cdf94b652b |
| children | 1a43699108a6 |
| rev | line source |
|---|---|
|
5536
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1 \documentstyle[twoside,11pt,myformat]{report} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
2 |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
3 \title{Python-C API Reference} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
4 |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
5 \input{boilerplate} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
6 |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
7 \makeindex % tell \index to actually write the .idx file |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
8 |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
9 |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
10 \begin{document} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
11 |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
12 \pagenumbering{roman} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
13 |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
14 \maketitle |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
15 |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
16 \input{copyright} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
17 |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
18 \begin{abstract} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
19 |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
20 \noindent |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
21 This manual documents the API used by C (or C++) programmers who want |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
22 to write extension modules or embed Python. It is a companion to |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
23 ``Extending and Embedding the Python Interpreter'', which describes |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
24 the general principles of extension writing but does not document the |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
25 API functions in detail. |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
26 |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
27 \end{abstract} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
28 |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
29 \pagebreak |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
30 |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
31 { |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
32 \parskip = 0mm |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
33 \tableofcontents |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
34 } |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
35 |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
36 \pagebreak |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
37 |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
38 \pagenumbering{arabic} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
39 |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
40 |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
41 \chapter{Introduction} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
42 |
|
5588
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
43 (XXX This is the old introduction, mostly by Jim Fulton -- should be |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
44 rewritten.) |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
45 |
|
5536
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
46 From the viewpoint of of C access to Python services, we have: |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
47 |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
48 \begin{enumerate} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
49 |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
50 \item "Very high level layer": two or three functions that let you |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
51 exec or eval arbitrary Python code given as a string in a module whose |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
52 name is given, passing C values in and getting C values out using |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
53 mkvalue/getargs style format strings. This does not require the user |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
54 to declare any variables of type \code{PyObject *}. This should be |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
55 enough to write a simple application that gets Python code from the |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
56 user, execs it, and returns the output or errors. |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
57 |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
58 \item "Abstract objects layer": which is the subject of this chapter. |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
59 It has many functions operating on objects, and lest you do many |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
60 things from C that you can also write in Python, without going through |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
61 the Python parser. |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
62 |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
63 \item "Concrete objects layer": This is the public type-dependent |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
64 interface provided by the standard built-in types, such as floats, |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
65 strings, and lists. This interface exists and is currently documented |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
66 by the collection of include files provides with the Python |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
67 distributions. |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
68 |
|
5588
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
69 \end{enumerate} |
|
5536
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
70 |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
71 From the point of view of Python accessing services provided by C |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
72 modules: |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
73 |
|
5588
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
74 \begin{enumerate} |
|
5536
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
75 |
|
5588
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
76 \item[4.] "Python module interface": this interface consist of the basic |
|
5536
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
77 routines used to define modules and their members. Most of the |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
78 current extensions-writing guide deals with this interface. |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
79 |
|
5588
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
80 \item[5.] "Built-in object interface": this is the interface that a new |
|
5536
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
81 built-in type must provide and the mechanisms and rules that a |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
82 developer of a new built-in type must use and follow. |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
83 |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
84 \end{enumerate} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
85 |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
86 The Python C API provides four groups of operations on objects, |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
87 corresponding to the same operations in the Python language: object, |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
88 numeric, sequence, and mapping. Each protocol consists of a |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
89 collection of related operations. If an operation that is not |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
90 provided by a particular type is invoked, then the standard exception |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
91 \code{TypeError} is raised with a operation name as an argument. |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
92 |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
93 In addition, for convenience this interface defines a set of |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
94 constructors for building objects of built-in types. This is needed |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
95 so new objects can be returned from C functions that otherwise treat |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
96 objects generically. |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
97 |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
98 \section{Reference Counting} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
99 |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
100 For most of the functions in the Python-C API, if a function retains a |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
101 reference to a Python object passed as an argument, then the function |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
102 will increase the reference count of the object. It is unnecessary |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
103 for the caller to increase the reference count of an argument in |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
104 anticipation of the object's retention. |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
105 |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
106 Usually, Python objects returned from functions should be treated as |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
107 new objects. Functions that return objects assume that the caller |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
108 will retain a reference and the reference count of the object has |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
109 already been incremented to account for this fact. A caller that does |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
110 not retain a reference to an object that is returned from a function |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
111 must decrement the reference count of the object (using |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
112 \code{Py_DECREF()}) to prevent memory leaks. |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
113 |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
114 Exceptions to these rules will be noted with the individual functions. |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
115 |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
116 \section{Include Files} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
117 |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
118 All function, type and macro definitions needed to use the Python-C |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
119 API are included in your code by the following line: |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
120 |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
121 \code{\#include "Python.h"} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
122 |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
123 This implies inclusion of the following standard header files: |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
124 stdio.h, string.h, errno.h, and stdlib.h (if available). |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
125 |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
126 All user visible names defined by Python.h (except those defined by |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
127 the included standard headers) have one of the prefixes \code{Py} or |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
128 \code{_Py}. Names beginning with \code{_Py} are for internal use |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
129 only. |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
130 |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
131 |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
132 \chapter{Initialization and Shutdown of an Embedded Python Interpreter} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
133 |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
134 When embedding the Python interpreter in a C or C++ program, the |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
135 interpreter must be initialized. |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
136 |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
137 \begin{cfuncdesc}{void}{PyInitialize}{} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
138 This function initializes the interpreter. It must be called before |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
139 any interaction with the interpreter takes place. If it is called |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
140 more than once, the second and further calls have no effect. |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
141 |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
142 The function performs the following tasks: create an environment in |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
143 which modules can be imported and Python code can be executed; |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
144 initialize the \code{__builtin__} module; initialize the \code{sys} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
145 module; initialize \code{sys.path}; initialize signal handling; and |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
146 create the empty \code{__main__} module. |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
147 |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
148 In the current system, there is no way to undo all these |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
149 initializations or to create additional interpreter environments. |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
150 \end{cfuncdesc} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
151 |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
152 \begin{cfuncdesc}{int}{Py_AtExit}{void (*func) ()} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
153 Register a cleanup function to be called when Python exits. The |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
154 cleanup function will be called with no arguments and should return no |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
155 value. At most 32 cleanup functions can be registered. When the |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
156 registration is successful, \code{Py_AtExit} returns 0; on failure, it |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
157 returns -1. Each cleanup function will be called t most once. The |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
158 cleanup function registered last is called first. |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
159 \end{cfuncdesc} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
160 |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
161 \begin{cfuncdesc}{void}{Py_Exit}{int status} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
162 Exit the current process. This calls \code{Py_Cleanup()} (see next |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
163 item) and performs additional cleanup (under some circumstances it |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
164 will attempt to delete all modules), and then calls the standard C |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
165 library function \code{exit(status)}. |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
166 \end{cfuncdesc} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
167 |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
168 \begin{cfuncdesc}{void}{Py_Cleanup}{} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
169 Perform some of the cleanup that \code{Py_Exit} performs, but don't |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
170 exit the process. In particular, this invokes the user's |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
171 \code{sys.exitfunc} function (if defined at all), and it invokes the |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
172 cleanup functions registered with \code{Py_AtExit()}, in reverse order |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
173 of their registration. |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
174 \end{cfuncdesc} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
175 |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
176 \begin{cfuncdesc}{void}{Py_FatalError}{char *message} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
177 Print a fatal error message and die. No cleanup is performed. This |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
178 function should only be invoked when a condition is detected that |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
179 would make it dangerous to continue using the Python interpreter; |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
180 e.g., when the object administration appears to be corrupted. |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
181 \end{cfuncdesc} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
182 |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
183 \begin{cfuncdesc}{void}{PyImport_Init}{} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
184 Initialize the module table. For internal use only. |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
185 \end{cfuncdesc} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
186 |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
187 \begin{cfuncdesc}{void}{PyImport_Cleanup}{} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
188 Empty the module table. For internal use only. |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
189 \end{cfuncdesc} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
190 |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
191 \begin{cfuncdesc}{void}{PyBuiltin_Init}{} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
192 Initialize the \code{__builtin__} module. For internal use only. |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
193 \end{cfuncdesc} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
194 |
|
5588
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
195 XXX Other init functions: PyEval_InitThreads, PyOS_InitInterrupts, |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
196 PyMarshal_Init, PySys_Init. |
|
5536
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
197 |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
198 \chapter{Reference Counting} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
199 |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
200 The functions in this chapter are used for managing reference counts |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
201 of Python objects. |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
202 |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
203 \begin{cfuncdesc}{void}{Py_INCREF}{PyObject *o} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
204 Increment the reference count for object \code{o}. The object must |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
205 not be \NULL{}; if you aren't sure that it isn't \NULL{}, use |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
206 \code{Py_XINCREF()}. |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
207 \end{cfuncdesc} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
208 |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
209 \begin{cfuncdesc}{void}{Py_XINCREF}{PyObject *o} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
210 Increment the reference count for object \code{o}. The object may be |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
211 \NULL{}, in which case the function has no effect. |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
212 \end{cfuncdesc} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
213 |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
214 \begin{cfuncdesc}{void}{Py_DECREF}{PyObject *o} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
215 Decrement the reference count for object \code{o}. The object must |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
216 not be \NULL{}; if you aren't sure that it isn't \NULL{}, use |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
217 \code{Py_XDECREF()}. If the reference count reaches zero, the object's |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
218 type's deallocation function (which must not be \NULL{}) is invoked. |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
219 |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
220 \strong{Warning:} The deallocation function can cause arbitrary Python |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
221 code to be invoked (e.g. when a class instance with a \code{__del__()} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
222 method is deallocated). While exceptions in such code are not |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
223 propagated, the executed code has free access to all Python global |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
224 variables. This means that any object that is reachable from a global |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
225 variable should be in a consistent state before \code{Py_DECREF()} is |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
226 invoked. For example, code to delete an object from a list should |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
227 copy a reference to the deleted object in a temporary variable, update |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
228 the list data structure, and then call \code{Py_DECREF()} for the |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
229 temporary variable. |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
230 \end{cfuncdesc} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
231 |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
232 \begin{cfuncdesc}{void}{Py_XDECREF}{PyObject *o} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
233 Decrement the reference count for object \code{o}.The object may be |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
234 \NULL{}, in which case the function has no effect; otherwise the |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
235 effect is the same as for \code{Py_DECREF()}, and the same warning |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
236 applies. |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
237 \end{cfuncdesc} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
238 |
|
5588
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
239 The following functions are only for internal use: |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
240 \code{_Py_Dealloc}, \code{_Py_ForgetReference}, \code{_Py_NewReference}, |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
241 as well as the global variable \code{_Py_RefTotal}. |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
242 |
|
5536
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
243 |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
244 \chapter{Exception Handling} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
245 |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
246 The functions in this chapter will let you handle and raise Python |
|
5588
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
247 exceptions. It is important to understand some of the basics of |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
248 Python exception handling. It works somewhat like the Unix |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
249 \code{errno} variable: there is a global indicator (per thread) of the |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
250 last error that occurred. Most functions don't clear this on success, |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
251 but will set it to indicate the cause of the error on failure. Most |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
252 functions also return an error indicator, usually \NULL{} if they are |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
253 supposed to return a pointer, or -1 if they return an integer |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
254 (exception: the \code{PyArg_Parse*()} functions return 1 for success and |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
255 0 for failure). When a function must fail because of some function it |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
256 called failed, it generally doesn't set the error indicator; the |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
257 function it called already set it. |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
258 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
259 The error indicator consists of three Python objects corresponding to |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
260 the Python variables \code{sys.exc_type}, \code{sys.exc_value} and |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
261 \code{sys.exc_traceback}. API functions exist to interact with the |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
262 error indicator in various ways. There is a separate error indicator |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
263 for each thread. |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
264 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
265 % XXX Order of these should be more thoughtful. |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
266 % Either alphabetical or some kind of structure. |
|
5536
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
267 |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
268 \begin{cfuncdesc}{void}{PyErr_Print}{} |
|
5588
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
269 Print a standard traceback to \code{sys.stderr} and clear the error |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
270 indicator. Call this function only when the error indicator is set. |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
271 (Otherwise it will cause a fatal error!) |
|
5536
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
272 \end{cfuncdesc} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
273 |
|
5588
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
274 \begin{cfuncdesc}{PyObject *}{PyErr_Occurred}{} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
275 Test whether the error indicator is set. If set, return the exception |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
276 \code{type} (the first argument to the last call to one of the |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
277 \code{PyErr_Set*()} functions or to \code{PyErr_Restore()}). If not |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
278 set, return \NULL{}. You do not own a reference to the return value, |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
279 so you do not need to \code{Py_DECREF()} it. |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
280 \end{cfuncdesc} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
281 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
282 \begin{cfuncdesc}{void}{PyErr_Clear}{} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
283 Clear the error indicator. If the error indicator is not set, there |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
284 is no effect. |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
285 \end{cfuncdesc} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
286 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
287 \begin{cfuncdesc}{void}{PyErr_Fetch}{PyObject **ptype, PyObject **pvalue, PyObject **ptraceback} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
288 Retrieve the error indicator into three variables whose addresses are |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
289 passed. If the error indicator is not set, set all three variables to |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
290 \NULL{}. If it is set, it will be cleared and you own a reference to |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
291 each object retrieved. The value and traceback object may be \NULL{} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
292 even when the type object is not. \strong{Note:} this function is |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
293 normally only used by code that needs to handle exceptions or by code |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
294 that needs to save and restore the error indicator temporarily. |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
295 \end{cfuncdesc} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
296 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
297 \begin{cfuncdesc}{void}{PyErr_Restore}{PyObject *type, PyObject *value, PyObject *traceback} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
298 Set the error indicator from the three objects. If the error |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
299 indicator is already set, it is cleared first. If the objects are |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
300 \NULL{}, the error indicator is cleared. Do not pass a \NULL{} type |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
301 and non-\NULL{} value or traceback. The exception type should be a |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
302 string or class; if it is a class, the value should be an instance of |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
303 that class. Do not pass an invalid exception type or value. |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
304 (Violating these rules will cause subtle problems later.) This call |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
305 takes away a reference to each object, i.e. you must own a reference |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
306 to each object before the call and after the call you no longer own |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
307 these references. (If you don't understand this, don't use this |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
308 function. I warned you.) \strong{Note:} this function is normally |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
309 only used by code that needs to save and restore the error indicator |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
310 temporarily. |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
311 \end{cfuncdesc} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
312 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
313 \begin{cfuncdesc}{void}{PyErr_SetString}{PyObject *type, char *message} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
314 This is the most common way to set the error indicator. The first |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
315 argument specifies the exception type; it is normally one of the |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
316 standard exceptions, e.g. \code{PyExc_RuntimeError}. You need not |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
317 increment its reference count. The second argument is an error |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
318 message; it is converted to a string object. |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
319 \end{cfuncdesc} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
320 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
321 \begin{cfuncdesc}{void}{PyErr_SetObject}{PyObject *type, PyObject *value} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
322 This function is similar to \code{PyErr_SetString()} but lets you |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
323 specify an arbitrary Python object for the ``value'' of the exception. |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
324 You need not increment its reference count. |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
325 \end{cfuncdesc} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
326 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
327 \begin{cfuncdesc}{void}{PyErr_SetNone}{PyObject *type} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
328 This is a shorthand for \code{PyErr_SetString(\var{type}, Py_None}. |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
329 \end{cfuncdesc} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
330 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
331 \begin{cfuncdesc}{int}{PyErr_BadArgument}{} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
332 This is a shorthand for \code{PyErr_SetString(PyExc_TypeError, |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
333 \var{message})}, where \var{message} indicates that a built-in operation |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
334 was invoked with an illegal argument. It is mostly for internal use. |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
335 \end{cfuncdesc} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
336 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
337 \begin{cfuncdesc}{PyObject *}{PyErr_NoMemory}{} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
338 This is a shorthand for \code{PyErr_SetNone(PyExc_MemoryError)}; it |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
339 returns \NULL{} so an object allocation function can write |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
340 \code{return PyErr_NoMemory();} when it runs out of memory. |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
341 \end{cfuncdesc} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
342 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
343 \begin{cfuncdesc}{PyObject *}{PyErr_SetFromErrno}{PyObject *type} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
344 This is a convenience function to raise an exception when a C library |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
345 function has returned an error and set the C variable \code{errno}. |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
346 It constructs a tuple object whose first item is the integer |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
347 \code{errno} value and whose second item is the corresponding error |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
348 message (gotten from \code{strerror()}), and then calls |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
349 \code{PyErr_SetObject(\var{type}, \var{object})}. On \UNIX{}, when |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
350 the \code{errno} value is \code{EINTR}, indicating an interrupted |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
351 system call, this calls \code{PyErr_CheckSignals()}, and if that set |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
352 the error indicator, leaves it set to that. The function always |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
353 returns \NULL{}, so a wrapper function around a system call can write |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
354 \code{return PyErr_NoMemory();} when the system call returns an error. |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
355 \end{cfuncdesc} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
356 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
357 \begin{cfuncdesc}{void}{PyErr_BadInternalCall}{} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
358 This is a shorthand for \code{PyErr_SetString(PyExc_TypeError, |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
359 \var{message})}, where \var{message} indicates that an internal |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
360 operation (e.g. a Python-C API function) was invoked with an illegal |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
361 argument. It is mostly for internal use. |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
362 \end{cfuncdesc} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
363 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
364 \begin{cfuncdesc}{int}{PyErr_CheckSignals}{} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
365 This function interacts with Python's signal handling. It checks |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
366 whether a signal has been sent to the processes and if so, invokes the |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
367 corresponding signal handler. If the \code{signal} module is |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
368 supported, this can invoke a signal handler written in Python. In all |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
369 cases, the default effect for \code{SIGINT} is to raise the |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
370 \code{KeyboadInterrupt} exception. If an exception is raised the |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
371 error indicator is set and the function returns 1; otherwise the |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
372 function returns 0. The error indicator may or may not be cleared if |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
373 it was previously set. |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
374 \end{cfuncdesc} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
375 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
376 \begin{cfuncdesc}{void}{PyErr_SetInterrupt}{} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
377 This function is obsolete (XXX or platform dependent?). It simulates |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
378 the effect of a \code{SIGINT} signal arriving -- the next time |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
379 \code{PyErr_CheckSignals()} is called, \code{KeyboadInterrupt} will be |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
380 raised. |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
381 \end{cfuncdesc} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
382 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
383 \section{Standard Exceptions} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
384 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
385 All standard Python exceptions are available as global variables whose |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
386 names are \code{PyExc_} followed by the Python exception name. |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
387 These have the type \code{PyObject *}; they are all string objects. |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
388 For completion, here are all the variables: |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
389 \code{PyExc_AccessError}, |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
390 \code{PyExc_AssertionError}, |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
391 \code{PyExc_AttributeError}, |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
392 \code{PyExc_EOFError}, |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
393 \code{PyExc_FloatingPointError}, |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
394 \code{PyExc_IOError}, |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
395 \code{PyExc_ImportError}, |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
396 \code{PyExc_IndexError}, |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
397 \code{PyExc_KeyError}, |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
398 \code{PyExc_KeyboardInterrupt}, |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
399 \code{PyExc_MemoryError}, |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
400 \code{PyExc_NameError}, |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
401 \code{PyExc_OverflowError}, |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
402 \code{PyExc_RuntimeError}, |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
403 \code{PyExc_SyntaxError}, |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
404 \code{PyExc_SystemError}, |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
405 \code{PyExc_SystemExit}, |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
406 \code{PyExc_TypeError}, |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
407 \code{PyExc_ValueError}, |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
408 \code{PyExc_ZeroDivisionError}. |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
409 |
|
5536
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
410 |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
411 \chapter{Utilities} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
412 |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
413 The functions in this chapter perform various utility tasks, such as |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
414 parsing function arguments and constructing Python values from C |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
415 values. |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
416 |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
417 \begin{cfuncdesc}{int}{Py_FdIsInteractive}{FILE *fp, char *filename} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
418 Return true (nonzero) if the standard I/O file \code{fp} with name |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
419 \code{filename} is deemed interactive. This is the case for files for |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
420 which \code{isatty(fileno(fp))} is true. If the global flag |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
421 \code{Py_InteractiveFlag} is true, this function also returns true if |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
422 the \code{name} pointer is \NULL{} or if the name is equal to one of |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
423 the strings \code{"<stdin>"} or \code{"???"}. |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
424 \end{cfuncdesc} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
425 |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
426 \begin{cfuncdesc}{long}{PyOS_GetLastModificationTime}{char *filename} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
427 Return the time of last modification of the file \code{filename}. |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
428 The result is encoded in the same way as the timestamp returned by |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
429 the standard C library function \code{time()}. |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
430 \end{cfuncdesc} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
431 |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
432 |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
433 \chapter{Debugging} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
434 |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
435 XXX Explain Py_DEBUG, Py_TRACE_REFS, Py_REF_DEBUG. |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
436 |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
437 |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
438 \chapter{The Very High Level Layer} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
439 |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
440 The functions in this chapter will let you execute Python source code |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
441 given in a file or a buffer, but they will not let you interact in a |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
442 more detailed way with the interpreter. |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
443 |
|
5588
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
444 \begin{cfuncdesc}{int}{PyRun_AnyFile}{FILE *, char *} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
445 \end{cfuncdesc} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
446 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
447 \begin{cfuncdesc}{int}{PyRun_SimpleString}{char *} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
448 \end{cfuncdesc} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
449 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
450 \begin{cfuncdesc}{int}{PyRun_SimpleFile}{FILE *, char *} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
451 \end{cfuncdesc} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
452 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
453 \begin{cfuncdesc}{int}{PyRun_InteractiveOne}{FILE *, char *} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
454 \end{cfuncdesc} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
455 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
456 \begin{cfuncdesc}{int}{PyRun_InteractiveLoop}{FILE *, char *} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
457 \end{cfuncdesc} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
458 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
459 \begin{cfuncdesc}{struct _node *}{PyParser_SimpleParseString}{char *, int} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
460 \end{cfuncdesc} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
461 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
462 \begin{cfuncdesc}{struct _node *}{PyParser_SimpleParseFile}{FILE *, char *, int} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
463 \end{cfuncdesc} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
464 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
465 \begin{cfuncdesc}{}{PyObject *PyRun}{ROTO((char *, int, PyObject *, PyObject *} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
466 \end{cfuncdesc} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
467 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
468 \begin{cfuncdesc}{}{PyObject *PyRun}{ROTO((FILE *, char *, int, PyObject *, PyObject *} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
469 \end{cfuncdesc} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
470 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
471 \begin{cfuncdesc}{}{PyObject *Py}{ROTO((char *, char *, int} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
472 \end{cfuncdesc} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
473 |
|
5536
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
474 |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
475 \chapter{Abstract Objects Layer} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
476 |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
477 The functions in this chapter interact with Python objects regardless |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
478 of their type, or with wide classes of object types (e.g. all |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
479 numerical types, or all sequence types). When used on object types |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
480 for which they do not apply, they will flag a Python exception. |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
481 |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
482 \section{Object Protocol} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
483 |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
484 \begin{cfuncdesc}{int}{PyObject_Print}{PyObject *o, FILE *fp, int flags} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
485 Print an object \code{o}, on file \code{fp}. Returns -1 on error |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
486 The flags argument is used to enable certain printing |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
487 options. The only option currently supported is \code{Py_Print_RAW}. |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
488 \end{cfuncdesc} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
489 |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
490 \begin{cfuncdesc}{int}{PyObject_HasAttrString}{PyObject *o, char *attr_name} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
491 Returns 1 if o has the attribute attr_name, and 0 otherwise. |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
492 This is equivalent to the Python expression: |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
493 \code{hasattr(o,attr_name)}. |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
494 This function always succeeds. |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
495 \end{cfuncdesc} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
496 |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
497 \begin{cfuncdesc}{PyObject*}{PyObject_GetAttrString}{PyObject *o, char *attr_name} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
498 Retrieve an attributed named attr_name form object o. |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
499 Returns the attribute value on success, or \NULL{} on failure. |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
500 This is the equivalent of the Python expression: \code{o.attr_name}. |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
501 \end{cfuncdesc} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
502 |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
503 |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
504 \begin{cfuncdesc}{int}{PyObject_HasAttr}{PyObject *o, PyObject *attr_name} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
505 Returns 1 if o has the attribute attr_name, and 0 otherwise. |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
506 This is equivalent to the Python expression: |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
507 \code{hasattr(o,attr_name)}. |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
508 This function always succeeds. |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
509 \end{cfuncdesc} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
510 |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
511 |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
512 \begin{cfuncdesc}{PyObject*}{PyObject_GetAttr}{PyObject *o, PyObject *attr_name} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
513 Retrieve an attributed named attr_name form object o. |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
514 Returns the attribute value on success, or \NULL{} on failure. |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
515 This is the equivalent of the Python expression: o.attr_name. |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
516 \end{cfuncdesc} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
517 |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
518 |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
519 \begin{cfuncdesc}{int}{PyObject_SetAttrString}{PyObject *o, char *attr_name, PyObject *v} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
520 Set the value of the attribute named \code{attr_name}, for object \code{o}, |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
521 to the value \code{v}. Returns -1 on failure. This is |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
522 the equivalent of the Python statement: \code{o.attr_name=v}. |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
523 \end{cfuncdesc} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
524 |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
525 |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
526 \begin{cfuncdesc}{int}{PyObject_SetAttr}{PyObject *o, PyObject *attr_name, PyObject *v} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
527 Set the value of the attribute named \code{attr_name}, for |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
528 object \code{o}, |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
529 to the value \code{v}. Returns -1 on failure. This is |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
530 the equivalent of the Python statement: \code{o.attr_name=v}. |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
531 \end{cfuncdesc} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
532 |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
533 |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
534 \begin{cfuncdesc}{int}{PyObject_DelAttrString}{PyObject *o, char *attr_name} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
535 Delete attribute named \code{attr_name}, for object \code{o}. Returns -1 on |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
536 failure. This is the equivalent of the Python |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
537 statement: \code{del o.attr_name}. |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
538 \end{cfuncdesc} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
539 |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
540 |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
541 \begin{cfuncdesc}{int}{PyObject_DelAttr}{PyObject *o, PyObject *attr_name} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
542 Delete attribute named \code{attr_name}, for object \code{o}. Returns -1 on |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
543 failure. This is the equivalent of the Python |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
544 statement: \code{del o.attr_name}. |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
545 \end{cfuncdesc} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
546 |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
547 |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
548 \begin{cfuncdesc}{int}{PyObject_Cmp}{PyObject *o1, PyObject *o2, int *result} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
549 Compare the values of \code{o1} and \code{o2} using a routine provided by |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
550 \code{o1}, if one exists, otherwise with a routine provided by \code{o2}. |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
551 The result of the comparison is returned in \code{result}. Returns |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
552 -1 on failure. This is the equivalent of the Python |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
553 statement: \code{result=cmp(o1,o2)}. |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
554 \end{cfuncdesc} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
555 |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
556 |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
557 \begin{cfuncdesc}{int}{PyObject_Compare}{PyObject *o1, PyObject *o2} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
558 Compare the values of \code{o1} and \code{o2} using a routine provided by |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
559 \code{o1}, if one exists, otherwise with a routine provided by \code{o2}. |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
560 Returns the result of the comparison on success. On error, |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
561 the value returned is undefined. This is equivalent to the |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
562 Python expression: \code{cmp(o1,o2)}. |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
563 \end{cfuncdesc} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
564 |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
565 |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
566 \begin{cfuncdesc}{PyObject*}{PyObject_Repr}{PyObject *o} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
567 Compute the string representation of object, \code{o}. Returns the |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
568 string representation on success, \NULL{} on failure. This is |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
569 the equivalent of the Python expression: \code{repr(o)}. |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
570 Called by the \code{repr()} built-in function and by reverse quotes. |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
571 \end{cfuncdesc} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
572 |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
573 |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
574 \begin{cfuncdesc}{PyObject*}{PyObject_Str}{PyObject *o} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
575 Compute the string representation of object, \code{o}. Returns the |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
576 string representation on success, \NULL{} on failure. This is |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
577 the equivalent of the Python expression: \code{str(o)}. |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
578 Called by the \code{str()} built-in function and by the \code{print} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
579 statement. |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
580 \end{cfuncdesc} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
581 |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
582 |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
583 \begin{cfuncdesc}{int}{PyCallable_Check}{PyObject *o} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
584 Determine if the object \code{o}, is callable. Return 1 if the |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
585 object is callable and 0 otherwise. |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
586 This function always succeeds. |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
587 \end{cfuncdesc} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
588 |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
589 |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
590 \begin{cfuncdesc}{PyObject*}{PyObject_CallObject}{PyObject *callable_object, PyObject *args} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
591 Call a callable Python object \code{callable_object}, with |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
592 arguments given by the tuple \code{args}. If no arguments are |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
593 needed, then args may be \NULL{}. Returns the result of the |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
594 call on success, or \NULL{} on failure. This is the equivalent |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
595 of the Python expression: \code{apply(o, args)}. |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
596 \end{cfuncdesc} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
597 |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
598 \begin{cfuncdesc}{PyObject*}{PyObject_CallFunction}{PyObject *callable_object, char *format, ...} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
599 Call a callable Python object \code{callable_object}, with a |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
600 variable number of C arguments. The C arguments are described |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
601 using a mkvalue-style format string. The format may be \NULL{}, |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
602 indicating that no arguments are provided. Returns the |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
603 result of the call on success, or \NULL{} on failure. This is |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
604 the equivalent of the Python expression: \code{apply(o,args)}. |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
605 \end{cfuncdesc} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
606 |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
607 |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
608 \begin{cfuncdesc}{PyObject*}{PyObject_CallMethod}{PyObject *o, char *m, char *format, ...} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
609 Call the method named \code{m} of object \code{o} with a variable number of |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
610 C arguments. The C arguments are described by a mkvalue |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
611 format string. The format may be \NULL{}, indicating that no |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
612 arguments are provided. Returns the result of the call on |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
613 success, or \NULL{} on failure. This is the equivalent of the |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
614 Python expression: \code{o.method(args)}. |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
615 Note that Special method names, such as "\code{__add__}", |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
616 "\code{__getitem__}", and so on are not supported. The specific |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
617 abstract-object routines for these must be used. |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
618 \end{cfuncdesc} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
619 |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
620 |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
621 \begin{cfuncdesc}{int}{PyObject_Hash}{PyObject *o} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
622 Compute and return the hash value of an object \code{o}. On |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
623 failure, return -1. This is the equivalent of the Python |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
624 expression: \code{hash(o)}. |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
625 \end{cfuncdesc} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
626 |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
627 |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
628 \begin{cfuncdesc}{int}{PyObject_IsTrue}{PyObject *o} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
629 Returns 1 if the object \code{o} is considered to be true, and |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
630 0 otherwise. This is equivalent to the Python expression: |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
631 \code{not not o}. |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
632 This function always succeeds. |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
633 \end{cfuncdesc} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
634 |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
635 |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
636 \begin{cfuncdesc}{PyObject*}{PyObject_Type}{PyObject *o} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
637 On success, returns a type object corresponding to the object |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
638 type of object \code{o}. On failure, returns \NULL{}. This is |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
639 equivalent to the Python expression: \code{type(o)}. |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
640 \end{cfuncdesc} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
641 |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
642 \begin{cfuncdesc}{int}{PyObject_Length}{PyObject *o} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
643 Return the length of object \code{o}. If the object \code{o} provides |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
644 both sequence and mapping protocols, the sequence length is |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
645 returned. On error, -1 is returned. This is the equivalent |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
646 to the Python expression: \code{len(o)}. |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
647 \end{cfuncdesc} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
648 |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
649 |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
650 \begin{cfuncdesc}{PyObject*}{PyObject_GetItem}{PyObject *o, PyObject *key} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
651 Return element of \code{o} corresponding to the object \code{key} or \NULL{} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
652 on failure. This is the equivalent of the Python expression: |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
653 \code{o[key]}. |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
654 \end{cfuncdesc} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
655 |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
656 |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
657 \begin{cfuncdesc}{int}{PyObject_SetItem}{PyObject *o, PyObject *key, PyObject *v} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
658 Map the object \code{key} to the value \code{v}. |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
659 Returns -1 on failure. This is the equivalent |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
660 of the Python statement: \code{o[key]=v}. |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
661 \end{cfuncdesc} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
662 |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
663 |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
664 \begin{cfuncdesc}{int}{PyObject_DelItem}{PyObject *o, PyObject *key, PyObject *v} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
665 Delete the mapping for \code{key} from \code{*o}. Returns -1 |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
666 on failure. |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
667 This is the equivalent of the Python statement: del o[key]. |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
668 \end{cfuncdesc} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
669 |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
670 |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
671 \section{Number Protocol} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
672 |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
673 \begin{cfuncdesc}{int}{PyNumber_Check}{PyObject *o} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
674 Returns 1 if the object \code{o} provides numeric protocols, and |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
675 false otherwise. |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
676 This function always succeeds. |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
677 \end{cfuncdesc} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
678 |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
679 |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
680 \begin{cfuncdesc}{PyObject*}{PyNumber_Add}{PyObject *o1, PyObject *o2} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
681 Returns the result of adding \code{o1} and \code{o2}, or null on failure. |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
682 This is the equivalent of the Python expression: \code{o1+o2}. |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
683 \end{cfuncdesc} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
684 |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
685 |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
686 \begin{cfuncdesc}{PyObject*}{PyNumber_Subtract}{PyObject *o1, PyObject *o2} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
687 Returns the result of subtracting \code{o2} from \code{o1}, or null on |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
688 failure. This is the equivalent of the Python expression: |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
689 \code{o1-o2}. |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
690 \end{cfuncdesc} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
691 |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
692 |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
693 \begin{cfuncdesc}{PyObject*}{PyNumber_Multiply}{PyObject *o1, PyObject *o2} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
694 Returns the result of multiplying \code{o1} and \code{o2}, or null on |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
695 failure. This is the equivalent of the Python expression: |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
696 \code{o1*o2}. |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
697 \end{cfuncdesc} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
698 |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
699 |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
700 \begin{cfuncdesc}{PyObject*}{PyNumber_Divide}{PyObject *o1, PyObject *o2} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
701 Returns the result of dividing \code{o1} by \code{o2}, or null on failure. |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
702 This is the equivalent of the Python expression: \code{o1/o2}. |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
703 \end{cfuncdesc} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
704 |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
705 |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
706 \begin{cfuncdesc}{PyObject*}{PyNumber_Remainder}{PyObject *o1, PyObject *o2} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
707 Returns the remainder of dividing \code{o1} by \code{o2}, or null on |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
708 failure. This is the equivalent of the Python expression: |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
709 \code{o1\%o2}. |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
710 \end{cfuncdesc} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
711 |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
712 |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
713 \begin{cfuncdesc}{PyObject*}{PyNumber_Divmod}{PyObject *o1, PyObject *o2} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
714 See the built-in function divmod. Returns \NULL{} on failure. |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
715 This is the equivalent of the Python expression: |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
716 \code{divmod(o1,o2)}. |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
717 \end{cfuncdesc} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
718 |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
719 |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
720 \begin{cfuncdesc}{PyObject*}{PyNumber_Power}{PyObject *o1, PyObject *o2, PyObject *o3} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
721 See the built-in function pow. Returns \NULL{} on failure. |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
722 This is the equivalent of the Python expression: |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
723 \code{pow(o1,o2,o3)}, where \code{o3} is optional. |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
724 \end{cfuncdesc} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
725 |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
726 |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
727 \begin{cfuncdesc}{PyObject*}{PyNumber_Negative}{PyObject *o} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
728 Returns the negation of \code{o} on success, or null on failure. |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
729 This is the equivalent of the Python expression: \code{-o}. |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
730 \end{cfuncdesc} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
731 |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
732 |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
733 \begin{cfuncdesc}{PyObject*}{PyNumber_Positive}{PyObject *o} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
734 Returns \code{o} on success, or \NULL{} on failure. |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
735 This is the equivalent of the Python expression: \code{+o}. |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
736 \end{cfuncdesc} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
737 |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
738 |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
739 \begin{cfuncdesc}{PyObject*}{PyNumber_Absolute}{PyObject *o} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
740 Returns the absolute value of \code{o}, or null on failure. This is |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
741 the equivalent of the Python expression: \code{abs(o)}. |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
742 \end{cfuncdesc} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
743 |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
744 |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
745 \begin{cfuncdesc}{PyObject*}{PyNumber_Invert}{PyObject *o} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
746 Returns the bitwise negation of \code{o} on success, or \NULL{} on |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
747 failure. This is the equivalent of the Python expression: |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
748 \code{~o}. |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
749 \end{cfuncdesc} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
750 |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
751 |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
752 \begin{cfuncdesc}{PyObject*}{PyNumber_Lshift}{PyObject *o1, PyObject *o2} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
753 Returns the result of left shifting \code{o1} by \code{o2} on success, or |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
754 \NULL{} on failure. This is the equivalent of the Python |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
755 expression: \code{o1 << o2}. |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
756 \end{cfuncdesc} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
757 |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
758 |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
759 \begin{cfuncdesc}{PyObject*}{PyNumber_Rshift}{PyObject *o1, PyObject *o2} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
760 Returns the result of right shifting \code{o1} by \code{o2} on success, or |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
761 \NULL{} on failure. This is the equivalent of the Python |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
762 expression: \code{o1 >> o2}. |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
763 \end{cfuncdesc} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
764 |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
765 |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
766 \begin{cfuncdesc}{PyObject*}{PyNumber_And}{PyObject *o1, PyObject *o2} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
767 Returns the result of "anding" \code{o2} and \code{o2} on success and \NULL{} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
768 on failure. This is the equivalent of the Python |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
769 expression: \code{o1 and o2}. |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
770 \end{cfuncdesc} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
771 |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
772 |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
773 \begin{cfuncdesc}{PyObject*}{PyNumber_Xor}{PyObject *o1, PyObject *o2} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
774 Returns the bitwise exclusive or of \code{o1} by \code{o2} on success, or |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
775 \NULL{} on failure. This is the equivalent of the Python |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
776 expression: \code{o1\^{ }o2}. |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
777 \end{cfuncdesc} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
778 |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
779 \begin{cfuncdesc}{PyObject*}{PyNumber_Or}{PyObject *o1, PyObject *o2} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
780 Returns the result or \code{o1} and \code{o2} on success, or \NULL{} on |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
781 failure. This is the equivalent of the Python expression: |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
782 \code{o1 or o2}. |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
783 \end{cfuncdesc} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
784 |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
785 |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
786 \begin{cfuncdesc}{PyObject*}{PyNumber_Coerce}{PyObject *o1, PyObject *o2} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
787 This function takes the addresses of two variables of type |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
788 \code{PyObject*}. |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
789 |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
790 If the objects pointed to by \code{*p1} and \code{*p2} have the same type, |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
791 increment their reference count and return 0 (success). |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
792 If the objects can be converted to a common numeric type, |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
793 replace \code{*p1} and \code{*p2} by their converted value (with 'new' |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
794 reference counts), and return 0. |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
795 If no conversion is possible, or if some other error occurs, |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
796 return -1 (failure) and don't increment the reference counts. |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
797 The call \code{PyNumber_Coerce(\&o1, \&o2)} is equivalent to the Python |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
798 statement \code{o1, o2 = coerce(o1, o2)}. |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
799 \end{cfuncdesc} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
800 |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
801 |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
802 \begin{cfuncdesc}{PyObject*}{PyNumber_Int}{PyObject *o} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
803 Returns the \code{o} converted to an integer object on success, or |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
804 \NULL{} on failure. This is the equivalent of the Python |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
805 expression: \code{int(o)}. |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
806 \end{cfuncdesc} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
807 |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
808 |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
809 \begin{cfuncdesc}{PyObject*}{PyNumber_Long}{PyObject *o} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
810 Returns the \code{o} converted to a long integer object on success, |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
811 or \NULL{} on failure. This is the equivalent of the Python |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
812 expression: \code{long(o)}. |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
813 \end{cfuncdesc} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
814 |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
815 |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
816 \begin{cfuncdesc}{PyObject*}{PyNumber_Float}{PyObject *o} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
817 Returns the \code{o} converted to a float object on success, or \NULL{} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
818 on failure. This is the equivalent of the Python expression: |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
819 \code{float(o)}. |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
820 \end{cfuncdesc} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
821 |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
822 |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
823 \section{Sequence protocol} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
824 |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
825 \begin{cfuncdesc}{int}{PySequence_Check}{PyObject *o} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
826 Return 1 if the object provides sequence protocol, and 0 |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
827 otherwise. |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
828 This function always succeeds. |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
829 \end{cfuncdesc} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
830 |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
831 |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
832 \begin{cfuncdesc}{PyObject*}{PySequence_Concat}{PyObject *o1, PyObject *o2} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
833 Return the concatination of \code{o1} and \code{o2} on success, and \NULL{} on |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
834 failure. This is the equivalent of the Python |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
835 expression: \code{o1+o2}. |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
836 \end{cfuncdesc} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
837 |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
838 |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
839 \begin{cfuncdesc}{PyObject*}{PySequence_Repeat}{PyObject *o, int count} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
840 Return the result of repeating sequence object \code{o} count times, |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
841 or \NULL{} on failure. This is the equivalent of the Python |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
842 expression: \code{o*count}. |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
843 \end{cfuncdesc} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
844 |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
845 |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
846 \begin{cfuncdesc}{PyObject*}{PySequence_GetItem}{PyObject *o, int i} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
847 Return the ith element of \code{o}, or \NULL{} on failure. This is the |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
848 equivalent of the Python expression: \code{o[i]}. |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
849 \end{cfuncdesc} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
850 |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
851 |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
852 \begin{cfuncdesc}{PyObject*}{PySequence_GetSlice}{PyObject *o, int i1, int i2} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
853 Return the slice of sequence object \code{o} between \code{i1} and \code{i2}, or |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
854 \NULL{} on failure. This is the equivalent of the Python |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
855 expression, \code{o[i1:i2]}. |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
856 \end{cfuncdesc} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
857 |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
858 |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
859 \begin{cfuncdesc}{int}{PySequence_SetItem}{PyObject *o, int i, PyObject *v} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
860 Assign object \code{v} to the \code{i}th element of \code{o}. |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
861 Returns -1 on failure. This is the equivalent of the Python |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
862 statement, \code{o[i]=v}. |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
863 \end{cfuncdesc} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
864 |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
865 \begin{cfuncdesc}{int}{PySequence_DelItem}{PyObject *o, int i} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
866 Delete the \code{i}th element of object \code{v}. Returns |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
867 -1 on failure. This is the equivalent of the Python |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
868 statement: \code{del o[i]}. |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
869 \end{cfuncdesc} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
870 |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
871 \begin{cfuncdesc}{int}{PySequence_SetSlice}{PyObject *o, int i1, int i2, PyObject *v} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
872 Assign the sequence object \code{v} to the slice in sequence |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
873 object \code{o} from \code{i1} to \code{i2}. This is the equivalent of the Python |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
874 statement, \code{o[i1:i2]=v}. |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
875 \end{cfuncdesc} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
876 |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
877 \begin{cfuncdesc}{int}{PySequence_DelSlice}{PyObject *o, int i1, int i2} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
878 Delete the slice in sequence object, \code{o}, from \code{i1} to \code{i2}. |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
879 Returns -1 on failure. This is the equivalent of the Python |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
880 statement: \code{del o[i1:i2]}. |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
881 \end{cfuncdesc} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
882 |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
883 \begin{cfuncdesc}{PyObject*}{PySequence_Tuple}{PyObject *o} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
884 Returns the \code{o} as a tuple on success, and \NULL{} on failure. |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
885 This is equivalent to the Python expression: \code{tuple(o)}. |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
886 \end{cfuncdesc} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
887 |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
888 \begin{cfuncdesc}{int}{PySequence_Count}{PyObject *o, PyObject *value} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
889 Return the number of occurrences of \code{value} on \code{o}, that is, |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
890 return the number of keys for which \code{o[key]==value}. On |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
891 failure, return -1. This is equivalent to the Python |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
892 expression: \code{o.count(value)}. |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
893 \end{cfuncdesc} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
894 |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
895 \begin{cfuncdesc}{int}{PySequence_In}{PyObject *o, PyObject *value} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
896 Determine if \code{o} contains \code{value}. If an item in \code{o} is equal to |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
897 \code{value}, return 1, otherwise return 0. On error, return -1. This |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
898 is equivalent to the Python expression: \code{value in o}. |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
899 \end{cfuncdesc} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
900 |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
901 \begin{cfuncdesc}{int}{PySequence_Index}{PyObject *o, PyObject *value} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
902 Return the first index for which \code{o[i]=value}. On error, |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
903 return -1. This is equivalent to the Python |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
904 expression: \code{o.index(value)}. |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
905 \end{cfuncdesc} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
906 |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
907 \section{Mapping protocol} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
908 |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
909 \begin{cfuncdesc}{int}{PyMapping_Check}{PyObject *o} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
910 Return 1 if the object provides mapping protocol, and 0 |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
911 otherwise. |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
912 This function always succeeds. |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
913 \end{cfuncdesc} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
914 |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
915 |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
916 \begin{cfuncdesc}{int}{PyMapping_Length}{PyObject *o} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
917 Returns the number of keys in object \code{o} on success, and -1 on |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
918 failure. For objects that do not provide sequence protocol, |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
919 this is equivalent to the Python expression: \code{len(o)}. |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
920 \end{cfuncdesc} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
921 |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
922 |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
923 \begin{cfuncdesc}{int}{PyMapping_DelItemString}{PyObject *o, char *key} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
924 Remove the mapping for object \code{key} from the object \code{o}. |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
925 Return -1 on failure. This is equivalent to |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
926 the Python statement: \code{del o[key]}. |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
927 \end{cfuncdesc} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
928 |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
929 |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
930 \begin{cfuncdesc}{int}{PyMapping_DelItem}{PyObject *o, PyObject *key} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
931 Remove the mapping for object \code{key} from the object \code{o}. |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
932 Return -1 on failure. This is equivalent to |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
933 the Python statement: \code{del o[key]}. |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
934 \end{cfuncdesc} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
935 |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
936 |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
937 \begin{cfuncdesc}{int}{PyMapping_HasKeyString}{PyObject *o, char *key} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
938 On success, return 1 if the mapping object has the key \code{key} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
939 and 0 otherwise. This is equivalent to the Python expression: |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
940 \code{o.has_key(key)}. |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
941 This function always succeeds. |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
942 \end{cfuncdesc} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
943 |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
944 |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
945 \begin{cfuncdesc}{int}{PyMapping_HasKey}{PyObject *o, PyObject *key} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
946 Return 1 if the mapping object has the key \code{key} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
947 and 0 otherwise. This is equivalent to the Python expression: |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
948 \code{o.has_key(key)}. |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
949 This function always succeeds. |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
950 \end{cfuncdesc} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
951 |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
952 |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
953 \begin{cfuncdesc}{PyObject*}{PyMapping_Keys}{PyObject *o} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
954 On success, return a list of the keys in object \code{o}. On |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
955 failure, return \NULL{}. This is equivalent to the Python |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
956 expression: \code{o.keys()}. |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
957 \end{cfuncdesc} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
958 |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
959 |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
960 \begin{cfuncdesc}{PyObject*}{PyMapping_Values}{PyObject *o} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
961 On success, return a list of the values in object \code{o}. On |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
962 failure, return \NULL{}. This is equivalent to the Python |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
963 expression: \code{o.values()}. |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
964 \end{cfuncdesc} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
965 |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
966 |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
967 \begin{cfuncdesc}{PyObject*}{PyMapping_Items}{PyObject *o} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
968 On success, return a list of the items in object \code{o}, where |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
969 each item is a tuple containing a key-value pair. On |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
970 failure, return \NULL{}. This is equivalent to the Python |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
971 expression: \code{o.items()}. |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
972 \end{cfuncdesc} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
973 |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
974 \begin{cfuncdesc}{int}{PyMapping_Clear}{PyObject *o} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
975 Make object \code{o} empty. Returns 1 on success and 0 on failure. |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
976 This is equivalent to the Python statement: |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
977 \code{for key in o.keys(): del o[key]} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
978 \end{cfuncdesc} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
979 |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
980 |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
981 \begin{cfuncdesc}{PyObject*}{PyMapping_GetItemString}{PyObject *o, char *key} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
982 Return element of \code{o} corresponding to the object \code{key} or \NULL{} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
983 on failure. This is the equivalent of the Python expression: |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
984 \code{o[key]}. |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
985 \end{cfuncdesc} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
986 |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
987 \begin{cfuncdesc}{PyObject*}{PyMapping_SetItemString}{PyObject *o, char *key, PyObject *v} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
988 Map the object \code{key} to the value \code{v} in object \code{o}. Returns |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
989 -1 on failure. This is the equivalent of the Python |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
990 statement: \code{o[key]=v}. |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
991 \end{cfuncdesc} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
992 |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
993 |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
994 \section{Constructors} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
995 |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
996 \begin{cfuncdesc}{PyObject*}{PyFile_FromString}{char *file_name, char *mode} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
997 On success, returns a new file object that is opened on the |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
998 file given by \code{file_name}, with a file mode given by \code{mode}, |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
999 where \code{mode} has the same semantics as the standard C routine, |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1000 fopen. On failure, return -1. |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1001 \end{cfuncdesc} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1002 |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1003 \begin{cfuncdesc}{PyObject*}{PyFile_FromFile}{FILE *fp, char *file_name, char *mode, int close_on_del} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1004 Return a new file object for an already opened standard C |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1005 file pointer, \code{fp}. A file name, \code{file_name}, and open mode, |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1006 \code{mode}, must be provided as well as a flag, \code{close_on_del}, that |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1007 indicates whether the file is to be closed when the file |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1008 object is destroyed. On failure, return -1. |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1009 \end{cfuncdesc} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1010 |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1011 \begin{cfuncdesc}{PyObject*}{PyFloat_FromDouble}{double v} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1012 Returns a new float object with the value \code{v} on success, and |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1013 \NULL{} on failure. |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1014 \end{cfuncdesc} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1015 |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1016 \begin{cfuncdesc}{PyObject*}{PyInt_FromLong}{long v} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1017 Returns a new int object with the value \code{v} on success, and |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1018 \NULL{} on failure. |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1019 \end{cfuncdesc} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1020 |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1021 \begin{cfuncdesc}{PyObject*}{PyList_New}{int l} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1022 Returns a new list of length \code{l} on success, and \NULL{} on |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1023 failure. |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1024 \end{cfuncdesc} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1025 |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1026 \begin{cfuncdesc}{PyObject*}{PyLong_FromLong}{long v} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1027 Returns a new long object with the value \code{v} on success, and |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1028 \NULL{} on failure. |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1029 \end{cfuncdesc} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1030 |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1031 \begin{cfuncdesc}{PyObject*}{PyLong_FromDouble}{double v} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1032 Returns a new long object with the value \code{v} on success, and |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1033 \NULL{} on failure. |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1034 \end{cfuncdesc} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1035 |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1036 \begin{cfuncdesc}{PyObject*}{PyDict_New}{} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1037 Returns a new empty dictionary on success, and \NULL{} on |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1038 failure. |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1039 \end{cfuncdesc} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1040 |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1041 \begin{cfuncdesc}{PyObject*}{PyString_FromString}{char *v} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1042 Returns a new string object with the value \code{v} on success, and |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1043 \NULL{} on failure. |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1044 \end{cfuncdesc} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1045 |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1046 \begin{cfuncdesc}{PyObject*}{PyString_FromStringAndSize}{char *v, int l} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1047 Returns a new string object with the value \code{v} and length \code{l} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1048 on success, and \NULL{} on failure. |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1049 \end{cfuncdesc} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1050 |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1051 \begin{cfuncdesc}{PyObject*}{PyTuple_New}{int l} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1052 Returns a new tuple of length \code{l} on success, and \NULL{} on |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1053 failure. |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1054 \end{cfuncdesc} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1055 |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1056 |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1057 \chapter{Concrete Objects Layer} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1058 |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1059 The functions in this chapter are specific to certain Python object |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1060 types. Passing them an object of the wrong type is not a good idea; |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1061 if you receive an object from a Python program and you are not sure |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1062 that it has the right type, you must perform a type check first; |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1063 e.g. to check that an object is a dictionary, use |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1064 \code{PyDict_Check()}. |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1065 |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1066 |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1067 \chapter{Defining New Object Types} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1068 |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1069 \begin{cfuncdesc}{PyObject *}{_PyObject_New}{PyTypeObject *type} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1070 \end{cfuncdesc} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1071 |
|
5588
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1072 \begin{cfuncdesc}{PyObject *}{_PyObject_NewVar}{PyTypeObject *type, int size} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1073 \end{cfuncdesc} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1074 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1075 \begin{cfuncdesc}{TYPE}{_PyObject_NEW}{TYPE, PyTypeObject *} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1076 \end{cfuncdesc} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1077 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1078 \begin{cfuncdesc}{TYPE}{_PyObject_NEW_VAR}{TYPE, PyTypeObject *, int size} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1079 \end{cfuncdesc} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1080 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1081 XXX To be done: |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1082 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1083 PyObject, PyVarObject |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1084 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1085 PyObject_HEAD, PyObject_HEAD_INIT, PyObject_VAR_HEAD |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1086 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1087 Typedefs: |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1088 unaryfunc, binaryfunc, ternaryfunc, inquiry, coercion, intargfunc, |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1089 intintargfunc, intobjargproc, intintobjargproc, objobjargproc, |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1090 getreadbufferproc, getwritebufferproc, getsegcountproc, |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1091 destructor, printfunc, getattrfunc, getattrofunc, setattrfunc, |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1092 setattrofunc, cmpfunc, reprfunc, hashfunc |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1093 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1094 PyNumberMethods |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1095 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1096 PySequenceMethods |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1097 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1098 PyMappingMethods |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1099 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1100 PyBufferProcs |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1101 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1102 PyTypeObject |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1103 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1104 DL_IMPORT |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1105 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1106 PyType_Type |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1107 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1108 Py*_Check |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1109 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1110 Py_None, _Py_NoneStruct |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1111 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1112 _PyObject_New, _PyObject_NewVar |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1113 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1114 PyObject_NEW, PyObject_NEW_VAR |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1115 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1116 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1117 \chapter{Specific Data Types} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1118 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1119 This chapter describes the functions that deal with specific types of |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1120 Python objects. It is structured like the ``family tree'' of Python |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1121 object types. |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1122 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1123 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1124 \section{Fundamental Objects} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1125 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1126 This section describes Python type objects and the singleton object |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1127 \code{None}. |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1128 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1129 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1130 \subsection{Type Objects} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1131 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1132 \begin{ctypedesc}{PyTypeObject} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1133 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1134 \end{ctypedesc} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1135 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1136 \begin{cvardesc}{PyObject *}{PyType_Type} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1137 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1138 \end{cvardesc} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1139 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1140 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1141 \subsection{The None Object} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1142 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1143 \begin{cvardesc}{PyObject *}{Py_None} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1144 macro |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1145 \end{cvardesc} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1146 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1147 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1148 \section{Sequence Objects} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1149 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1150 Generic operations on sequence objects were discussed in the previous |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1151 chapter; this section deals with the specific kinds of sequence |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1152 objects that are intrinsuc to the Python language. |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1153 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1154 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1155 \subsection{String Objects} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1156 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1157 \begin{ctypedesc}{PyStringObject} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1158 This subtype of \code{PyObject} represents a Python string object. |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1159 \end{ctypedesc} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1160 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1161 \begin{cvardesc}{PyTypeObject}{PyString_Type} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1162 This instance of \code{PyTypeObject} represents the Python string type. |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1163 \end{cvardesc} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1164 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1165 \begin{cfuncdesc}{int}{PyString_Check}{PyObject *o} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1166 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1167 \end{cfuncdesc} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1168 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1169 \begin{cfuncdesc}{PyObject *}{PyString_FromStringAndSize}{const char *, int} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1170 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1171 \end{cfuncdesc} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1172 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1173 \begin{cfuncdesc}{PyObject *}{PyString_FromString}{const char *} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1174 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1175 \end{cfuncdesc} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1176 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1177 \begin{cfuncdesc}{int}{PyString_Size}{PyObject *} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1178 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1179 \end{cfuncdesc} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1180 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1181 \begin{cfuncdesc}{char *}{PyString_AsString}{PyObject *} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1182 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1183 \end{cfuncdesc} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1184 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1185 \begin{cfuncdesc}{void}{PyString_Concat}{PyObject **, PyObject *} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1186 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1187 \end{cfuncdesc} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1188 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1189 \begin{cfuncdesc}{void}{PyString_ConcatAndDel}{PyObject **, PyObject *} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1190 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1191 \end{cfuncdesc} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1192 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1193 \begin{cfuncdesc}{int}{_PyString_Resize}{PyObject **, int} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1194 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1195 \end{cfuncdesc} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1196 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1197 \begin{cfuncdesc}{PyObject *}{PyString_Format}{PyObject *, PyObject *} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1198 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1199 \end{cfuncdesc} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1200 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1201 \begin{cfuncdesc}{void}{PyString_InternInPlace}{PyObject **} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1202 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1203 \end{cfuncdesc} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1204 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1205 \begin{cfuncdesc}{PyObject *}{PyString_InternFromString}{const char *} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1206 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1207 \end{cfuncdesc} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1208 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1209 \begin{cfuncdesc}{char *}{PyString_AS_STRING}{PyStringObject *} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1210 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1211 \end{cfuncdesc} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1212 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1213 \begin{cfuncdesc}{int}{PyString_GET_SIZE}{PyStringObject *} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1214 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1215 \end{cfuncdesc} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1216 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1217 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1218 \subsection{Tuple Objects} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1219 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1220 \begin{ctypedesc}{PyTupleObject} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1221 This subtype of \code{PyObject} represents a Python tuple object. |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1222 \end{ctypedesc} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1223 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1224 \begin{cvardesc}{PyTypeObject}{PyTuple_Type} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1225 This instance of \code{PyTypeObject} represents the Python tuple type. |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1226 \end{cvardesc} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1227 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1228 \begin{cfuncdesc}{int}{PyTuple_Check}{PyObject *p} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1229 Return true if the argument is a tuple object. |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1230 \end{cfuncdesc} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1231 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1232 \begin{cfuncdesc}{PyTupleObject *}{PyTuple_New}{int s} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1233 Return a new tuple object of size \code{s} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1234 \end{cfuncdesc} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1235 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1236 \begin{cfuncdesc}{int}{PyTuple_Size}{PyTupleObject *p} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1237 akes a pointer to a tuple object, and returns the size |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1238 of that tuple. |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1239 \end{cfuncdesc} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1240 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1241 \begin{cfuncdesc}{PyObject *}{PyTuple_GetItem}{PyTupleObject *p, int pos} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1242 returns the object at position \code{pos} in the tuple pointed |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1243 to by \code{p}. |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1244 \end{cfuncdesc} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1245 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1246 \begin{cfuncdesc}{PyObject *}{PyTuple_GET_ITEM}{PyTupleObject *p, int pos} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1247 does the same, but does no checking of it's |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1248 arguments. |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1249 \end{cfuncdesc} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1250 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1251 \begin{cfuncdesc}{PyTupleObject *}{PyTuple_GetSlice}{PyTupleObject *p, |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1252 int low, |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1253 int high} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1254 takes a slice of the tuple pointed to by \code{p} from |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1255 \code{low} to \code{high} and returns it as a new tuple. |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1256 \end{cfuncdesc} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1257 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1258 \begin{cfuncdesc}{int}{PyTuple_SetItem}{PyTupleObject *p, |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1259 int pos, |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1260 PyObject *o} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1261 inserts a reference to object \code{o} at position \code{pos} of |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1262 the tuple pointed to by \code{p}. It returns 0 on success. |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1263 \end{cfuncdesc} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1264 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1265 \begin{cfuncdesc}{void}{PyTuple_SET_ITEM}{PyTupleObject *p, |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1266 int pos, |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1267 PyObject *o} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1268 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1269 does the same, but does no error checking, and |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1270 should \emph{only} be used to fill in brand new tuples. |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1271 \end{cfuncdesc} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1272 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1273 \begin{cfuncdesc}{PyTupleObject *}{_PyTuple_Resize}{PyTupleObject *p, |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1274 int new, |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1275 int last_is_sticky} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1276 can be used to resize a tuple. Because tuples are |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1277 \emph{supposed} to be immutable, this should only be used if there is only |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1278 one module referencing the object. Do \emph{not} use this if the tuple may |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1279 already be known to some other part of the code. \code{last_is_sticky} is |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1280 a flag - if set, the tuple will grow or shrink at the front, otherwise |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1281 it will grow or shrink at the end. Think of this as destroying the old |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1282 tuple and creating a new one, only more efficiently. |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1283 \end{cfuncdesc} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1284 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1285 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1286 \subsection{List Objects} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1287 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1288 \begin{ctypedesc}{PyListObject} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1289 This subtype of \code{PyObject} represents a Python list object. |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1290 \end{ctypedesc} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1291 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1292 \begin{cvardesc}{PyTypeObject}{PyList_Type} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1293 This instance of \code{PyTypeObject} represents the Python list type. |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1294 \end{cvardesc} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1295 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1296 \begin{cfuncdesc}{int}{PyList_Check}{PyObject *p} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1297 returns true if it's argument is a \code{PyListObject} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1298 \end{cfuncdesc} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1299 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1300 \begin{cfuncdesc}{PyObject *}{PyList_New}{int size} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1301 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1302 \end{cfuncdesc} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1303 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1304 \begin{cfuncdesc}{int}{PyList_Size}{PyObject *} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1305 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1306 \end{cfuncdesc} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1307 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1308 \begin{cfuncdesc}{PyObject *}{PyList_GetItem}{PyObject *, int} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1309 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1310 \end{cfuncdesc} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1311 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1312 \begin{cfuncdesc}{int}{PyList_SetItem}{PyObject *, int, PyObject *} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1313 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1314 \end{cfuncdesc} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1315 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1316 \begin{cfuncdesc}{int}{PyList_Insert}{PyObject *, int, PyObject *} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1317 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1318 \end{cfuncdesc} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1319 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1320 \begin{cfuncdesc}{int}{PyList_Append}{PyObject *, PyObject *} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1321 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1322 \end{cfuncdesc} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1323 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1324 \begin{cfuncdesc}{PyObject *}{PyList_GetSlice}{PyObject *, int, int} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1325 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1326 \end{cfuncdesc} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1327 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1328 \begin{cfuncdesc}{int}{PyList_SetSlice}{PyObject *, int, int, PyObject *} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1329 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1330 \end{cfuncdesc} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1331 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1332 \begin{cfuncdesc}{int}{PyList_Sort}{PyObject *} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1333 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1334 \end{cfuncdesc} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1335 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1336 \begin{cfuncdesc}{int}{PyList_Reverse}{PyObject *} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1337 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1338 \end{cfuncdesc} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1339 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1340 \begin{cfuncdesc}{PyObject *}{PyList_AsTuple}{PyObject *} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1341 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1342 \end{cfuncdesc} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1343 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1344 \begin{cfuncdesc}{PyObject *}{PyList_GET_ITEM}{PyObject *list, int i} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1345 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1346 \end{cfuncdesc} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1347 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1348 \begin{cfuncdesc}{int}{PyList_GET_SIZE}{PyObject *list} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1349 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1350 \end{cfuncdesc} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1351 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1352 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1353 \section{Mapping Objects} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1354 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1355 \subsection{Dictionary Objects} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1356 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1357 \begin{ctypedesc}{PyDictObject} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1358 This subtype of \code{PyObject} represents a Python dictionary object. |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1359 \end{ctypedesc} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1360 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1361 \begin{cvardesc}{PyTypeObject}{PyDict_Type} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1362 This instance of \code{PyTypeObject} represents the Python dictionary type. |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1363 \end{cvardesc} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1364 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1365 \begin{cfuncdesc}{int}{PyDict_Check}{PyObject *p} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1366 returns true if it's argument is a PyDictObject |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1367 \end{cfuncdesc} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1368 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1369 \begin{cfuncdesc}{PyDictObject *}{PyDict_New}{} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1370 returns a new empty dictionary. |
|
5536
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1371 \end{cfuncdesc} |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1372 |
|
5588
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1373 \begin{cfuncdesc}{void}{PyDict_Clear}{PyDictObject *p} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1374 empties an existing dictionary and deletes it. |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1375 \end{cfuncdesc} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1376 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1377 \begin{cfuncdesc}{int}{PyDict_SetItem}{PyDictObject *p, |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1378 PyObject *key, |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1379 PyObject *val} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1380 inserts \code{value} into the dictionary with a key of |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1381 \code{key}. Both \code{key} and \code{value} should be PyObjects, and \code{key} should |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1382 be hashable. |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1383 \end{cfuncdesc} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1384 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1385 \begin{cfuncdesc}{int}{PyDict_SetItemString}{PyDictObject *p, |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1386 char *key, |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1387 PyObject *val} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1388 inserts \code{value} into the dictionary using \code{key} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1389 as a key. \code{key} should be a char * |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1390 \end{cfuncdesc} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1391 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1392 \begin{cfuncdesc}{int}{PyDict_DelItem}{PyDictObject *p, PyObject *key} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1393 removes the entry in dictionary \code{p} with key \code{key}. |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1394 \code{key} is a PyObject. |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1395 \end{cfuncdesc} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1396 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1397 \begin{cfuncdesc}{int}{PyDict_DelItemString}{PyDictObject *p, char *key} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1398 removes the entry in dictionary \code{p} which has a key |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1399 specified by the \code{char *}\code{key}. |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1400 \end{cfuncdesc} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1401 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1402 \begin{cfuncdesc}{PyObject *}{PyDict_GetItem}{PyDictObject *p, PyObject *key} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1403 returns the object from dictionary \code{p} which has a key |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1404 \code{key}. |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1405 \end{cfuncdesc} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1406 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1407 \begin{cfuncdesc}{PyObject *}{PyDict_GetItemString}{PyDictObject *p, char *key} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1408 does the same, but \code{key} is specified as a |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1409 \code{char *}, rather than a \code{PyObject *}. |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1410 \end{cfuncdesc} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1411 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1412 \begin{cfuncdesc}{PyListObject *}{PyDict_Items}{PyDictObject *p} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1413 returns a PyListObject containing all the items |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1414 from the dictionary, as in the mapping method \code{items()} (see the Reference |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1415 Guide) |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1416 \end{cfuncdesc} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1417 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1418 \begin{cfuncdesc}{PyListObject *}{PyDict_Keys}{PyDictObject *p} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1419 returns a PyListObject containing all the keys |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1420 from the dictionary, as in the mapping method \code{keys()} (see the Reference Guide) |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1421 \end{cfuncdesc} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1422 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1423 \begin{cfuncdesc}{PyListObject *}{PyDict_Values}{PyDictObject *p} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1424 returns a PyListObject containing all the values |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1425 from the dictionary, as in the mapping method \code{values()} (see the Reference Guide) |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1426 \end{cfuncdesc} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1427 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1428 \begin{cfuncdesc}{int}{PyDict_Size}{PyDictObject *p} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1429 returns the number of items in the dictionary. |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1430 \end{cfuncdesc} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1431 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1432 \begin{cfuncdesc}{int}{PyDict_Next}{PyDictObject *p, |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1433 int ppos, |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1434 PyObject **pkey, |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1435 PyObject **pvalue} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1436 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1437 \end{cfuncdesc} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1438 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1439 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1440 \section{Numeric Objects} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1441 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1442 \subsection{Plain Integer Objects} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1443 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1444 \begin{ctypedesc}{PyIntObject} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1445 This subtype of \code{PyObject} represents a Python integer object. |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1446 \end{ctypedesc} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1447 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1448 \begin{cvardesc}{PyTypeObject}{PyInt_Type} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1449 This instance of \code{PyTypeObject} represents the Python plain |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1450 integer type. |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1451 \end{cvardesc} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1452 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1453 \begin{cfuncdesc}{int}{PyInt_Check}{PyObject *} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1454 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1455 \end{cfuncdesc} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1456 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1457 \begin{cfuncdesc}{PyIntObject *}{PyInt_FromLong}{long ival} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1458 creates a new integer object with a value of \code{ival}. |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1459 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1460 The current implementation keeps an array of integer objects for all |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1461 integers between -1 and 100, when you create an int in that range you |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1462 actually just get back a reference to the existing object. So it should |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1463 be possible to change the value of 1. I suspect the behaviour of python |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1464 in this case is undefined. :-) |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1465 \end{cfuncdesc} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1466 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1467 \begin{cfuncdesc}{long}{PyInt_AS_LONG}{PyIntObject *io} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1468 returns the value of the object \code{io}. |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1469 \end{cfuncdesc} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1470 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1471 \begin{cfuncdesc}{long}{PyInt_AsLong}{PyObject *io} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1472 will first attempt to cast the object to a PyIntObject, if |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1473 it is not already one, and the return it's value. |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1474 \end{cfuncdesc} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1475 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1476 \begin{cfuncdesc}{long}{PyInt_GetMax}{} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1477 returns the systems idea of the largest int it can handle |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1478 (LONG_MAX, as defined in the system header files) |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1479 \end{cfuncdesc} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1480 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1481 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1482 \subsection{Long Integer Objects} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1483 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1484 \begin{ctypedesc}{PyLongObject} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1485 This subtype of \code{PyObject} represents a Python long integer object. |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1486 \end{ctypedesc} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1487 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1488 \begin{cvardesc}{PyTypeObject}{PyLong_Type} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1489 This instance of \code{PyTypeObject} represents the Python long integer type. |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1490 \end{cvardesc} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1491 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1492 \begin{cfuncdesc}{int}{PyLong_Check}{PyObject *p} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1493 returns true if it's argument is a \code{PyLongObject} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1494 \end{cfuncdesc} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1495 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1496 \begin{cfuncdesc}{PyObject *}{PyLong_FromLong}{long} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1497 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1498 \end{cfuncdesc} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1499 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1500 \begin{cfuncdesc}{PyObject *}{PyLong_FromUnsignedLong}{unsigned long} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1501 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1502 \end{cfuncdesc} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1503 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1504 \begin{cfuncdesc}{PyObject *}{PyLong_FromDouble}{double} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1505 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1506 \end{cfuncdesc} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1507 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1508 \begin{cfuncdesc}{long}{PyLong_AsLong}{PyObject *} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1509 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1510 \end{cfuncdesc} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1511 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1512 \begin{cfuncdesc}{unsigned long}{PyLong_AsUnsignedLong}{PyObject } |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1513 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1514 \end{cfuncdesc} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1515 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1516 \begin{cfuncdesc}{double}{PyLong_AsDouble}{PyObject *} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1517 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1518 \end{cfuncdesc} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1519 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1520 \begin{cfuncdesc}{PyObject *}{*PyLong_FromString}{char *, char **, int} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1521 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1522 \end{cfuncdesc} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1523 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1524 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1525 \subsection{Floating Point Objects} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1526 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1527 \begin{ctypedesc}{PyFloatObject} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1528 This subtype of \code{PyObject} represents a Python floating point object. |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1529 \end{ctypedesc} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1530 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1531 \begin{cvardesc}{PyTypeObject}{PyFloat_Type} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1532 This instance of \code{PyTypeObject} represents the Python floating |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1533 point type. |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1534 \end{cvardesc} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1535 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1536 \begin{cfuncdesc}{int}{PyFloat_Check}{PyObject *p} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1537 returns true if it's argument is a \code{PyFloatObject} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1538 \end{cfuncdesc} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1539 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1540 \begin{cfuncdesc}{PyObject *}{PyFloat_FromDouble}{double} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1541 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1542 \end{cfuncdesc} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1543 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1544 \begin{cfuncdesc}{double}{PyFloat_AsDouble}{PyObject *} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1545 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1546 \end{cfuncdesc} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1547 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1548 \begin{cfuncdesc}{double}{PyFloat_AS_DOUBLE}{PyFloatObject *} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1549 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1550 \end{cfuncdesc} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1551 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1552 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1553 \subsection{Complex Number Objects} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1554 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1555 \begin{ctypedesc}{Py_complex} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1556 typedef struct { |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1557 double real; |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1558 double imag; |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1559 } |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1560 \end{ctypedesc} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1561 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1562 \begin{ctypedesc}{PyComplexObject} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1563 This subtype of \code{PyObject} represents a Python complex number object. |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1564 \end{ctypedesc} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1565 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1566 \begin{cvardesc}{PyTypeObject}{PyComplex_Type} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1567 This instance of \code{PyTypeObject} represents the Python complex |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1568 number type. |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1569 \end{cvardesc} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1570 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1571 \begin{cfuncdesc}{int}{PyComplex_Check}{PyObject *p} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1572 returns true if it's argument is a \code{PyComplexObject} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1573 \end{cfuncdesc} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1574 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1575 \begin{cfuncdesc}{Py_complex}{_Py_c_sum}{Py_complex, Py_complex} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1576 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1577 \end{cfuncdesc} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1578 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1579 \begin{cfuncdesc}{Py_complex}{_Py_c_diff}{Py_complex, Py_complex} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1580 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1581 \end{cfuncdesc} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1582 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1583 \begin{cfuncdesc}{Py_complex}{_Py_c_neg}{Py_complex} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1584 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1585 \end{cfuncdesc} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1586 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1587 \begin{cfuncdesc}{Py_complex}{_Py_c_prod}{Py_complex, Py_complex} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1588 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1589 \end{cfuncdesc} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1590 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1591 \begin{cfuncdesc}{Py_complex}{_Py_c_quot}{Py_complex, Py_complex} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1592 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1593 \end{cfuncdesc} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1594 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1595 \begin{cfuncdesc}{Py_complex}{_Py_c_pow}{Py_complex, Py_complex} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1596 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1597 \end{cfuncdesc} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1598 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1599 \begin{cfuncdesc}{PyObject *}{PyComplex_FromCComplex}{Py_complex} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1600 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1601 \end{cfuncdesc} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1602 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1603 \begin{cfuncdesc}{PyObject *}{PyComplex_FromDoubles}{double real, double imag} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1604 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1605 \end{cfuncdesc} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1606 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1607 \begin{cfuncdesc}{double}{PyComplex_RealAsDouble}{PyObject *op} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1608 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1609 \end{cfuncdesc} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1610 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1611 \begin{cfuncdesc}{double}{PyComplex_ImagAsDouble}{PyObject *op} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1612 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1613 \end{cfuncdesc} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1614 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1615 \begin{cfuncdesc}{Py_complex}{PyComplex_AsCComplex}{PyObject *op} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1616 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1617 \end{cfuncdesc} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1618 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1619 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1620 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1621 \section{Other Objects} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1622 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1623 \subsection{File Objects} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1624 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1625 \begin{ctypedesc}{PyFileObject} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1626 This subtype of \code{PyObject} represents a Python file object. |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1627 \end{ctypedesc} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1628 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1629 \begin{cvardesc}{PyTypeObject}{PyFile_Type} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1630 This instance of \code{PyTypeObject} represents the Python file type. |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1631 \end{cvardesc} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1632 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1633 \begin{cfuncdesc}{int}{PyFile_Check}{PyObject *p} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1634 returns true if it's argument is a \code{PyFileObject} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1635 \end{cfuncdesc} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1636 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1637 \begin{cfuncdesc}{PyObject *}{PyFile_FromString}{char *name, char *mode} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1638 creates a new PyFileObject pointing to the file |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1639 specified in \code{name} with the mode specified in \code{mode} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1640 \end{cfuncdesc} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1641 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1642 \begin{cfuncdesc}{PyObject *}{PyFile_FromFile}{FILE *fp, |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1643 char *name, char *mode, int (*close}) |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1644 creates a new PyFileObject from the already-open \code{fp}. |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1645 The function \code{close} will be called when the file should be closed. |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1646 \end{cfuncdesc} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1647 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1648 \begin{cfuncdesc}{FILE *}{PyFile_AsFile}{PyFileObject *p} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1649 returns the file object associated with \code{p} as a \code{FILE *} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1650 \end{cfuncdesc} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1651 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1652 \begin{cfuncdesc}{PyStringObject *}{PyFile_GetLine}{PyObject *p, int n} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1653 undocumented as yet |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1654 \end{cfuncdesc} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1655 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1656 \begin{cfuncdesc}{PyStringObject *}{PyFile_Name}{PyObject *p} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1657 returns the name of the file specified by \code{p} as a |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1658 PyStringObject |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1659 \end{cfuncdesc} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1660 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1661 \begin{cfuncdesc}{void}{PyFile_SetBufSize}{PyFileObject *p, int n} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1662 on systems with \code{setvbuf} only |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1663 \end{cfuncdesc} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1664 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1665 \begin{cfuncdesc}{int}{PyFile_SoftSpace}{PyFileObject *p, int newflag} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1666 same as the file object method \code{softspace} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1667 \end{cfuncdesc} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1668 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1669 \begin{cfuncdesc}{int}{PyFile_WriteObject}{PyObject *obj, PyFileObject *p} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1670 writes object \code{obj} to file object \code{p} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1671 \end{cfuncdesc} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1672 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1673 \begin{cfuncdesc}{int}{PyFile_WriteString}{char *s, PyFileObject *p} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1674 writes string \code{s} to file object \code{p} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1675 \end{cfuncdesc} |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1676 |
|
53cdf94b652b
Just another checkin for backup. Nothing substantial yet.
Guido van Rossum <guido@python.org>
parents:
5536
diff
changeset
|
1677 |
|
5536
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1678 \input{api.ind} % Index -- must be last |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1679 |
|
c6f04e965508
Made a start with api.tex, the Python-C API Reference Manual.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1680 \end{document} |
