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
e6f15bd7
Commit
e6f15bd7
authored
Apr 12, 2006
by
Andrew M. Kuchling
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Note C API incompatibilities
parent
483b1f16
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
32 additions
and
0 deletions
+32
-0
Doc/whatsnew/whatsnew25.tex
Doc/whatsnew/whatsnew25.tex
+32
-0
No files found.
Doc/whatsnew/whatsnew25.tex
View file @
e6f15bd7
...
...
@@ -1453,6 +1453,23 @@ actually drop when you delete them, and the memory may be returned to
the operating system. (Implemented by Evan Jones, and reworked by Tim
Peters.)
Note that this change means extension modules need to be more careful
with how they allocate memory. Python's API has a number of different
functions for allocating memory that are grouped into families. For
example,
\cfunction
{
PyMem
_
Malloc()
}
,
\cfunction
{
PyMem
_
Realloc()
}
, and
\cfunction
{
PyMem
_
Free()
}
are one family that allocates raw memory,
while
\cfunction
{
PyObject
_
Malloc()
}
,
\cfunction
{
PyObject
_
Realloc()
}
,
and
\cfunction
{
PyObject
_
Free()
}
are another family that's supposed to
be used for creating Python objects.
Previously these different families all reduced to the platform's
\cfunction
{
malloc()
}
and
\cfunction
{
free()
}
functions. This meant
it didn't matter if you got things wrong and allocated memory with the
\cfunction
{
PyMem
}
function but freed it with the
\cfunction
{
PyObject
}
function. With the obmalloc change, these families now do different
things, and mismatches will probably result in a segfault. You should
carefully test your C extension modules with Python 2.5.
\item
Coverity, a company that markets a source code analysis tool
called Prevent, provided the results of their examination of the Python
source code. The analysis found a number of refcounting bugs, often
...
...
@@ -1472,6 +1489,21 @@ changes to your code:
\item
The
\module
{
pickle
}
module no longer uses the deprecated
\var
{
bin
}
parameter.
\item
C API: Many functions now use
\ctype
{
Py
_
ssize
_
t
}
instead of
\ctype
{
int
}
to allow processing more data
on 64-bit machines. Extension code may need to make
the same change to avoid warnings and to support 64-bit machines.
See the earlier
section~ref
{
section-353
}
for a discussion of this change.
\item
C API:
The obmalloc changes mean that
you must be careful to not mix usage
of the
\cfunction
{
PyMem
_
*()
}
and
\cfunction
{
PyObject
_
*()
}
families of functions. Memory allocated with
one family's
\cfunction
{
*
_
Malloc()
}
must be
freed with the corresponding family's
\cfunction
{
*
_
Free()
}
function.
\end{itemize}
...
...
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