Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
6bd8d720
Commit
6bd8d720
authored
Nov 06, 1996
by
Guido van Rossum
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added 'Introduction' section head and 'Memory Management' subsection.
parent
7bd43828
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
1 deletion
+20
-1
Doc/extref.tex
Doc/extref.tex
+20
-1
No files found.
Doc/extref.tex
View file @
6bd8d720
...
...
@@ -2,6 +2,8 @@
\chapter
{
Extension Reference
}
\section
{
Introduction
}
From the viewpoint of of C access to Python services, we have:
\begin{enumerate}
...
...
@@ -13,7 +15,7 @@ From the viewpoint of of C access to Python services, we have:
to write a simple application that gets Python code from the user,
execs it, and returns the output or errors.
\item
"Abstract objects layer": which is the subject of this
proposal
.
\item
"Abstract objects layer": which is the subject of this
chapter
.
It has many functions operating on objects, and lest you do many
things from C that you can also write in Python, without going
through the Python parser.
...
...
@@ -46,6 +48,23 @@ From the viewpoint of of C access to Python services, we have:
so new objects can be returned from C functions that otherwise treat
objects generically.
\subsection
{
Memory Management
}
For all of the functions described in this chapter, if a function
retains a reference to a Python object passed as an argument, then the
function will increase the reference count of the object. It is
unnecessary for the caller to increase the reference count of an
argument in anticipation of the object's retention.
All Python objects returned from functions should be treated as new
objects. Functions that return objects assume that the caller will
retain a reference and the reference count of the object has already
been incremented to account for this fact. A caller that does not
retain a reference to an object that is returned from a function
must decrement the reference count of the object (using
DECREF(object)) to prevent memory leaks.
\section
{
Object Protocol
}
\begin{cfuncdesc}
{
int
}{
PyObject
_
Print
}{
PyObject *o, FILE *fp, int flags
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment