Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
c88feceb
Unverified
Kaydet (Commit)
c88feceb
authored
Nis 13, 2019
tarafından
Inada Naoki
Kaydeden (comit)
GitHub
Nis 13, 2019
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Doc: define PY_SSIZE_T_CLEAN always (GH-12794)
üst
a304b136
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
22 additions
and
4 deletions
+22
-4
intro.rst
Doc/c-api/intro.rst
+5
-1
embedding.rst
Doc/extending/embedding.rst
+1
-0
extending.rst
Doc/extending/extending.rst
+8
-3
extending.rst
Doc/faq/extending.rst
+2
-0
custom.c
Doc/includes/custom.c
+1
-0
custom2.c
Doc/includes/custom2.c
+1
-0
custom3.c
Doc/includes/custom3.c
+1
-0
custom4.c
Doc/includes/custom4.c
+1
-0
run-func.c
Doc/includes/run-func.c
+1
-0
sublist.c
Doc/includes/sublist.c
+1
-0
No files found.
Doc/c-api/intro.rst
Dosyayı görüntüle @
c88feceb
...
@@ -48,7 +48,8 @@ Include Files
...
@@ -48,7 +48,8 @@ Include Files
All function, type and macro definitions needed to use the Python/C API are
All function, type and macro definitions needed to use the Python/C API are
included in your code by the following line::
included in your code by the following line::
#include "Python.h"
#define PY_SSIZE_T_CLEAN
#include <Python.h>
This implies inclusion of the following standard headers: ``<stdio.h>``,
This implies inclusion of the following standard headers: ``<stdio.h>``,
``<string.h>``, ``<errno.h>``, ``<limits.h>``, ``<assert.h>`` and ``<stdlib.h>``
``<string.h>``, ``<errno.h>``, ``<limits.h>``, ``<assert.h>`` and ``<stdlib.h>``
...
@@ -60,6 +61,9 @@ This implies inclusion of the following standard headers: ``<stdio.h>``,
...
@@ -60,6 +61,9 @@ This implies inclusion of the following standard headers: ``<stdio.h>``,
headers on some systems, you *must* include :file:`Python.h` before any standard
headers on some systems, you *must* include :file:`Python.h` before any standard
headers are included.
headers are included.
It is recommended to always define ``PY_SSIZE_T_CLEAN`` before including
``Python.h``. See :ref:`arg-parsing` for a description of this macro.
All user visible names defined by Python.h (except those defined by the included
All user visible names defined by Python.h (except those defined by the included
standard headers) have one of the prefixes ``Py`` or ``_Py``. Names beginning
standard headers) have one of the prefixes ``Py`` or ``_Py``. Names beginning
with ``_Py`` are for internal use by the Python implementation and should not be
with ``_Py`` are for internal use by the Python implementation and should not be
...
...
Doc/extending/embedding.rst
Dosyayı görüntüle @
c88feceb
...
@@ -53,6 +53,7 @@ interface. This interface is intended to execute a Python script without needing
...
@@ -53,6 +53,7 @@ interface. This interface is intended to execute a Python script without needing
to interact with the application directly. This can for example be used to
to interact with the application directly. This can for example be used to
perform some operation on a file. ::
perform some operation on a file. ::
#define PY_SSIZE_T_CLEAN
#include <Python.h>
#include <Python.h>
int
int
...
...
Doc/extending/extending.rst
Dosyayı görüntüle @
c88feceb
...
@@ -55,8 +55,9 @@ called ``spam``, the C file containing its implementation is called
...
@@ -55,8 +55,9 @@ called ``spam``, the C file containing its implementation is called
:file:`spammodule.c`; if the module name is very long, like ``spammify``, the
:file:`spammodule.c`; if the module name is very long, like ``spammify``, the
module name can be just :file:`spammify.c`.)
module name can be just :file:`spammify.c`.)
The first
line
of our file can be::
The first
two lines
of our file can be::
#define PY_SSIZE_T_CLEAN
#include <Python.h>
#include <Python.h>
which pulls in the Python API (you can add a comment describing the purpose of
which pulls in the Python API (you can add a comment describing the purpose of
...
@@ -68,6 +69,9 @@ the module and a copyright notice if you like).
...
@@ -68,6 +69,9 @@ the module and a copyright notice if you like).
headers on some systems, you *must* include :file:`Python.h` before any standard
headers on some systems, you *must* include :file:`Python.h` before any standard
headers are included.
headers are included.
It is recommended to always define ``PY_SSIZE_T_CLEAN`` before including
``Python.h``. See :ref:`parsetuple` for a description of this macro.
All user-visible symbols defined by :file:`Python.h` have a prefix of ``Py`` or
All user-visible symbols defined by :file:`Python.h` have a prefix of ``Py`` or
``PY``, except those defined in standard header files. For convenience, and
``PY``, except those defined in standard header files. For convenience, and
since they are used extensively by the Python interpreter, ``"Python.h"``
since they are used extensively by the Python interpreter, ``"Python.h"``
...
@@ -729,7 +733,8 @@ it returns false and raises an appropriate exception.
...
@@ -729,7 +733,8 @@ it returns false and raises an appropriate exception.
Here is an example module which uses keywords, based on an example by Geoff
Here is an example module which uses keywords, based on an example by Geoff
Philbrick (philbrick@hks.com)::
Philbrick (philbrick@hks.com)::
#include "Python.h"
#define PY_SSIZE_T_CLEAN /* Make "s#" use Py_ssize_t rather than int. */
#include <Python.h>
static PyObject *
static PyObject *
keywdarg_parrot(PyObject *self, PyObject *args, PyObject *keywds)
keywdarg_parrot(PyObject *self, PyObject *args, PyObject *keywds)
...
@@ -1228,7 +1233,7 @@ The function :c:func:`spam_system` is modified in a trivial way::
...
@@ -1228,7 +1233,7 @@ The function :c:func:`spam_system` is modified in a trivial way::
In the beginning of the module, right after the line ::
In the beginning of the module, right after the line ::
#include
"Python.h"
#include
<Python.h>
two more lines must be added::
two more lines must be added::
...
...
Doc/faq/extending.rst
Dosyayı görüntüle @
c88feceb
...
@@ -280,6 +280,7 @@ solution then is to call :c:func:`PyParser_ParseString` and test for ``e.error``
...
@@ -280,6 +280,7 @@ solution then is to call :c:func:`PyParser_ParseString` and test for ``e.error``
equal to ``E_EOF``, which means the input is incomplete. Here's a sample code
equal to ``E_EOF``, which means the input is incomplete. Here's a sample code
fragment, untested, inspired by code from Alex Farber::
fragment, untested, inspired by code from Alex Farber::
#define PY_SSIZE_T_CLEAN
#include <Python.h>
#include <Python.h>
#include <node.h>
#include <node.h>
#include <errcode.h>
#include <errcode.h>
...
@@ -318,6 +319,7 @@ complete example using the GNU readline library (you may want to ignore
...
@@ -318,6 +319,7 @@ complete example using the GNU readline library (you may want to ignore
#include <stdio.h>
#include <stdio.h>
#include <readline.h>
#include <readline.h>
#define PY_SSIZE_T_CLEAN
#include <Python.h>
#include <Python.h>
#include <object.h>
#include <object.h>
#include <compile.h>
#include <compile.h>
...
...
Doc/includes/custom.c
Dosyayı görüntüle @
c88feceb
#define PY_SSIZE_T_CLEAN
#include <Python.h>
#include <Python.h>
typedef
struct
{
typedef
struct
{
...
...
Doc/includes/custom2.c
Dosyayı görüntüle @
c88feceb
#define PY_SSIZE_T_CLEAN
#include <Python.h>
#include <Python.h>
#include "structmember.h"
#include "structmember.h"
...
...
Doc/includes/custom3.c
Dosyayı görüntüle @
c88feceb
#define PY_SSIZE_T_CLEAN
#include <Python.h>
#include <Python.h>
#include "structmember.h"
#include "structmember.h"
...
...
Doc/includes/custom4.c
Dosyayı görüntüle @
c88feceb
#define PY_SSIZE_T_CLEAN
#include <Python.h>
#include <Python.h>
#include "structmember.h"
#include "structmember.h"
...
...
Doc/includes/run-func.c
Dosyayı görüntüle @
c88feceb
#define PY_SSIZE_T_CLEAN
#include <Python.h>
#include <Python.h>
int
int
...
...
Doc/includes/sublist.c
Dosyayı görüntüle @
c88feceb
#define PY_SSIZE_T_CLEAN
#include <Python.h>
#include <Python.h>
typedef
struct
{
typedef
struct
{
...
...
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