Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 103b548

Browse files
committed
Add a note warning against semicolons following PyObject_HEAD.
Minor cleanups.
1 parent 64e5aa9 commit 103b548

1 file changed

Lines changed: 9 additions & 5 deletions

File tree

Doc/ext/newtypes.tex

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,15 @@ \section{The Basics
5959
than every Python object contains - a refcount and a pointer to a type
6060
object. These are the fields the \code{PyObject_HEAD} macro brings
6161
in. The reason for the macro is to standardize the layout and to
62-
enable special debugging fields to be brought in debug builds.
62+
enable special debugging fields in debug builds. Note that there is
63+
no semicolon after the \code{PyObject_HEAD} macro; one is included in
64+
the macro definition. Be wary of adding one by accident; it's easy to
65+
do from habit, and your compiler might not complain, but someone
66+
else's probably will! (On Windows, MSVC is known to call this an
67+
error and refuse to produce compiled code.)
6368

64-
For contrast
69+
For contrast, let's take a look at the corresponding definition for
70+
standard Python integers:
6571

6672
\begin{verbatim}
6773
typedef struct {
@@ -70,8 +76,6 @@ \section{The Basics
7076
} PyIntObject;
7177
\end{verbatim}
7278

73-
is the corresponding definition for standard Python integers.
74-
7579
Next up is:
7680

7781
\begin{verbatim}
@@ -491,7 +495,7 @@ \subsection{Object Representation}
491495
\end{verbatim}
492496

493497

494-
\subsection{Attribute Management Functions}
498+
\subsection{Attribute Management}
495499

496500
For every object which can support attributes, the corresponding type
497501
must provide the functions that control how the attributes are

0 commit comments

Comments
 (0)