mirror of
https://github.com/AdaCore/cpython.git
synced 2026-02-12 12:57:15 -08:00
#1629: Renamed Py_Size, Py_Type and Py_Refcnt to Py_SIZE, Py_TYPE and Py_REFCNT.
This commit is contained in:
@@ -72,8 +72,6 @@ new feature.
|
||||
Python 3.0
|
||||
================
|
||||
|
||||
.. % XXX add general comment about Python 3.0 features in 2.6
|
||||
|
||||
The development cycle for Python 2.6 also saw the release of the first
|
||||
alphas of Python 3.0, and the development of 3.0 has influenced
|
||||
a number of features in 2.6.
|
||||
@@ -95,7 +93,9 @@ are:
|
||||
A new command-line switch, :option:`-3`, enables warnings
|
||||
about features that will be removed in Python 3.0. You can run code
|
||||
with this switch to see how much work will be necessary to port
|
||||
code to 3.0.
|
||||
code to 3.0. The value of this switch is available
|
||||
to Python code as the boolean variable ``sys.py3kwarning``,
|
||||
and to C extension code as :cdata:`Py_Py3kWarningFlag`.
|
||||
|
||||
.. seealso::
|
||||
|
||||
@@ -103,6 +103,62 @@ code to 3.0.
|
||||
Python 3.0 and various features that have been accepted, rejected,
|
||||
or are still under consideration.
|
||||
|
||||
|
||||
Development Changes
|
||||
==================================================
|
||||
|
||||
While 2.6 was being developed, the Python development process
|
||||
underwent two significant changes: the developer group
|
||||
switched from SourceForge's issue tracker to a customized
|
||||
Roundup installation, and the documentation was converted from
|
||||
LaTeX to reStructured Text.
|
||||
|
||||
|
||||
New Issue Tracker: Roundup
|
||||
--------------------------------------------------
|
||||
|
||||
XXX write this.
|
||||
|
||||
|
||||
New Documentation Format: ReStructured Text
|
||||
--------------------------------------------------
|
||||
|
||||
Python's documentation had been written using LaTeX since the
|
||||
project's inception around 1989. At that time, most documentation was
|
||||
printed out for later study, not viewed online. LaTeX was widely used
|
||||
because it provided attractive printed output while
|
||||
remaining straightforward to write, once the basic rules
|
||||
of the markup have been learned.
|
||||
|
||||
LaTeX is still used today for writing technical publications destined
|
||||
for printing, but the landscape for programming tools has shifted. We
|
||||
no longer print out reams of documentation; instead, we browse through
|
||||
it online and HTML is the most important format to support.
|
||||
Unfortunately, converting LaTeX to HTML is fairly complicated, and
|
||||
Fred L. Drake Jr., the Python documentation editor for many years,
|
||||
spent a lot of time wrestling the conversion process into shape.
|
||||
Occasionally people would suggest converting the documentation into
|
||||
SGML or, later, XML, but performing a good conversion is a major task
|
||||
and no one pursued the task to completion.
|
||||
|
||||
During the 2.6 development cycle, Georg Brandl put a substantial
|
||||
effort into building a new toolchain called Sphinx
|
||||
for processing the documentation.
|
||||
The input format is reStructured Text,
|
||||
a markup commonly used in the Python community that supports
|
||||
custom extensions and directives. Sphinx concentrates
|
||||
on its HTML output, producing attractively styled
|
||||
and modern HTML. (XXX finish this -- mention new search feature)
|
||||
|
||||
.. seealso::
|
||||
|
||||
`Docutils <http://docutils.sf.net>`__: The fundamental
|
||||
reStructured Text parser and toolset.
|
||||
|
||||
`Documenting Python <XXX>`__: Describes how to write for
|
||||
Python's documentation.
|
||||
|
||||
|
||||
PEP 343: The 'with' statement
|
||||
=============================
|
||||
|
||||
@@ -352,6 +408,24 @@ bound to a variable, and calls ``object.close`` at the end of the block. ::
|
||||
|
||||
.. % ======================================================================
|
||||
|
||||
.. _pep-0366:
|
||||
|
||||
PEP 366: Explicit Relative Imports From a Main Module
|
||||
============================================================
|
||||
|
||||
Python's :option:`-m` switch allows running a module as a script.
|
||||
When you ran a module that was located inside a package, relative
|
||||
imports didn't work correctly.
|
||||
|
||||
The fix in Python 2.6 adds a :attr:`__package__` attribute to modules.
|
||||
When present, relative imports will be relative to the value of this
|
||||
attribute instead of the :attr:`__name__` attribute. PEP 302-style
|
||||
importers can then set :attr:`__package__`. The :mod:`runpy` module
|
||||
that implements the :option:`-m` switch now does this, so relative imports
|
||||
can now be used in scripts running from inside a package.
|
||||
|
||||
.. % ======================================================================
|
||||
|
||||
.. _pep-3110:
|
||||
|
||||
PEP 3110: Exception-Handling Changes
|
||||
@@ -414,7 +488,7 @@ XXX
|
||||
:pep:`3119` - Introducing Abstract Base Classes
|
||||
PEP written by Guido van Rossum and Talin.
|
||||
Implemented by XXX.
|
||||
Backported to 2.6 by Benjamin Aranguren (with Alex Martelli).
|
||||
Backported to 2.6 by Benjamin Aranguren, with Alex Martelli.
|
||||
|
||||
Other Language Changes
|
||||
======================
|
||||
@@ -443,6 +517,25 @@ Here are all of the changes that Python 2.6 makes to the core Python language.
|
||||
|
||||
.. % Revision 57619
|
||||
|
||||
* Properties now have two attributes,
|
||||
:attr:`setter` and :attr:`deleter`, that are useful shortcuts for
|
||||
adding a setter or deleter function to an existing property.
|
||||
You would use them like this::
|
||||
|
||||
class C(object):
|
||||
@property
|
||||
def x(self):
|
||||
return self._x
|
||||
|
||||
@x.setter
|
||||
def x(self, value):
|
||||
self._x = value
|
||||
|
||||
@x.deleter
|
||||
def x(self):
|
||||
del self._x
|
||||
|
||||
|
||||
* C functions and methods that use
|
||||
:cfunc:`PyComplex_AsCComplex` will now accept arguments that
|
||||
have a :meth:`__complex__` method. In particular, the functions in the
|
||||
@@ -452,11 +545,26 @@ Here are all of the changes that Python 2.6 makes to the core Python language.
|
||||
|
||||
.. % Patch #1675423
|
||||
|
||||
A numerical nicety: when creating a complex number from two floats
|
||||
on systems that support signed zeros (-0 and +0), the
|
||||
:func:`complex()` constructor will now preserve the sign
|
||||
of the zero.
|
||||
|
||||
.. % Patch 1507
|
||||
|
||||
* Changes to the :class:`Exception` interface
|
||||
as dictated by :pep:`352` continue to be made. For 2.6,
|
||||
the :attr:`message` attribute is being deprecated in favor of the
|
||||
:attr:`args` attribute.
|
||||
|
||||
* The :exc:`GeneratorExit` exception now subclasses
|
||||
:exc:`BaseException` instead of :exc:`Exception`. This means
|
||||
that an exception handler that does ``except Exception:``
|
||||
will not inadvertently catch :exc:`GeneratorExit`.
|
||||
(Contributed by Chad Austin.)
|
||||
|
||||
.. % Patch #1537
|
||||
|
||||
* The :func:`compile` built-in function now accepts keyword arguments
|
||||
as well as positional parameters. (Contributed by Thomas Wouters.)
|
||||
|
||||
@@ -653,6 +761,20 @@ complete list of changes, or look through the CVS logs for all the details.
|
||||
|
||||
.. % Patch #1490190
|
||||
|
||||
* The :mod:`new` module has been removed from Python 3.0.
|
||||
Importing it therefore
|
||||
triggers a warning message when Python is running in 3.0-warning
|
||||
mode.
|
||||
|
||||
* New functions in the :mod:`os` module include
|
||||
``fchmod(fd, mode)``, ``fchown(fd, uid, gid)``,
|
||||
and ``lchmod(path, mode)``, on operating systems that support these
|
||||
functions. :func:`fchmod` and :func:`fchown` let you change the mode
|
||||
and ownership of an opened file, and :func:`lchmod` changes the mode
|
||||
of a symlink.
|
||||
|
||||
(Contributed by Georg Brandl and Christian Heimes.)
|
||||
|
||||
* The :func:`os.walk` function now has a ``followlinks`` parameter. If
|
||||
set to True, it will follow symlinks pointing to directories and
|
||||
visit the directory's contents. For backward compatibility, the
|
||||
@@ -703,6 +825,15 @@ complete list of changes, or look through the CVS logs for all the details.
|
||||
changed and :const:`UF_APPEND` to indicate that data can only be appended to the
|
||||
file. (Contributed by M. Levinson.)
|
||||
|
||||
* The :mod:`random` module's :class:`Random` objects can
|
||||
now be pickled on a 32-bit system and unpickled on a 64-bit
|
||||
system, and vice versa. Unfortunately, this change also means
|
||||
that Python 2.6's :class:`Random` objects can't be unpickled correctly
|
||||
on earlier versions of Python.
|
||||
(Contributed by Shawn Ligocki.)
|
||||
|
||||
.. % Issue 1727780
|
||||
|
||||
* The :mod:`rgbimg` module has been removed.
|
||||
|
||||
* The :mod:`sets` module has been deprecated; it's better to
|
||||
@@ -725,6 +856,17 @@ complete list of changes, or look through the CVS logs for all the details.
|
||||
|
||||
.. % Patch #957003
|
||||
|
||||
* A new variable in the :mod:`sys` module,
|
||||
:attr:`float_info`, is a dictionary
|
||||
containing information about the platform's floating-point support
|
||||
derived from the :file:`float.h` file. Key/value pairs
|
||||
in this dictionary include
|
||||
``"mant_dig"`` (number of digits in the mantissa), ``"epsilon"``
|
||||
(smallest difference between 1.0 and the next largest value
|
||||
representable), and several others. (Contributed by Christian Heimes.)
|
||||
|
||||
.. % Patch 1534
|
||||
|
||||
* The :mod:`tarfile` module now supports POSIX.1-2001 (pax) and
|
||||
POSIX.1-1988 (ustar) format tarfiles, in addition to the GNU tar
|
||||
format that was already supported. The default format
|
||||
@@ -883,6 +1025,17 @@ Changes to Python's build process and to the C API include:
|
||||
|
||||
.. % Patch 1551895
|
||||
|
||||
* Several functions return information about the platform's
|
||||
floating-point support. :cfunc:`PyFloat_GetMax` returns
|
||||
the maximum representable floating point value,
|
||||
and :cfunc:`PyFloat_GetMin` returns the minimum
|
||||
positive value. :cfunc:`PyFloat_GetInfo` returns a dictionary
|
||||
containing more information from the :file:`float.h` file, such as
|
||||
``"mant_dig"`` (number of digits in the mantissa), ``"epsilon"``
|
||||
(smallest difference between 1.0 and the next largest value
|
||||
representable), and several others.
|
||||
|
||||
.. % Issue 1534
|
||||
|
||||
.. % ======================================================================
|
||||
|
||||
|
||||
@@ -1070,7 +1070,7 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
|
||||
*/
|
||||
|
||||
#define PySequence_ITEM(o, i)\
|
||||
( Py_Type(o)->tp_as_sequence->sq_item(o, i) )
|
||||
( Py_TYPE(o)->tp_as_sequence->sq_item(o, i) )
|
||||
/* Assume tp_as_sequence and sq_item exist and that i does not
|
||||
need to be corrected for a negative index
|
||||
*/
|
||||
|
||||
@@ -9,7 +9,7 @@ extern "C" {
|
||||
|
||||
PyAPI_DATA(PyTypeObject) PyBool_Type;
|
||||
|
||||
#define PyBool_Check(x) (Py_Type(x) == &PyBool_Type)
|
||||
#define PyBool_Check(x) (Py_TYPE(x) == &PyBool_Type)
|
||||
|
||||
/* Py_False and Py_True are the only two bools in existence.
|
||||
Don't forget to apply Py_INCREF() when returning either!!! */
|
||||
|
||||
@@ -33,7 +33,7 @@ PyAPI_DATA(PyTypeObject) PyBytesIter_Type;
|
||||
|
||||
/* Type check macros */
|
||||
#define PyBytes_Check(self) PyObject_TypeCheck(self, &PyBytes_Type)
|
||||
#define PyBytes_CheckExact(self) (Py_Type(self) == &PyBytes_Type)
|
||||
#define PyBytes_CheckExact(self) (Py_TYPE(self) == &PyBytes_Type)
|
||||
|
||||
/* Direct API functions */
|
||||
PyAPI_FUNC(PyObject *) PyBytes_FromObject(PyObject *);
|
||||
@@ -45,7 +45,7 @@ PyAPI_FUNC(int) PyBytes_Resize(PyObject *, Py_ssize_t);
|
||||
|
||||
/* Macros, trading safety for speed */
|
||||
#define PyBytes_AS_STRING(self) (assert(PyBytes_Check(self)),((PyBytesObject *)(self))->ob_bytes)
|
||||
#define PyBytes_GET_SIZE(self) (assert(PyBytes_Check(self)),Py_Size(self))
|
||||
#define PyBytes_GET_SIZE(self) (assert(PyBytes_Check(self)),Py_SIZE(self))
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -60,9 +60,9 @@ static struct PycStringIO_CAPI {
|
||||
|
||||
/* These can be used to test if you have one */
|
||||
#define PycStringIO_InputCheck(O) \
|
||||
(Py_Type(O)==PycStringIO->InputType)
|
||||
(Py_TYPE(O)==PycStringIO->InputType)
|
||||
#define PycStringIO_OutputCheck(O) \
|
||||
(Py_Type(O)==PycStringIO->OutputType)
|
||||
(Py_TYPE(O)==PycStringIO->OutputType)
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ typedef struct {
|
||||
|
||||
PyAPI_DATA(PyTypeObject) PyCell_Type;
|
||||
|
||||
#define PyCell_Check(op) (Py_Type(op) == &PyCell_Type)
|
||||
#define PyCell_Check(op) (Py_TYPE(op) == &PyCell_Type)
|
||||
|
||||
PyAPI_FUNC(PyObject *) PyCell_New(PyObject *);
|
||||
PyAPI_FUNC(PyObject *) PyCell_Get(PyObject *);
|
||||
|
||||
@@ -16,7 +16,7 @@ extern "C" {
|
||||
|
||||
PyAPI_DATA(PyTypeObject) PyCObject_Type;
|
||||
|
||||
#define PyCObject_Check(op) (Py_Type(op) == &PyCObject_Type)
|
||||
#define PyCObject_Check(op) (Py_TYPE(op) == &PyCObject_Type)
|
||||
|
||||
/* Create a PyCObject from a pointer to a C object and an optional
|
||||
destructor function. If the second argument is non-null, then it
|
||||
|
||||
@@ -59,7 +59,7 @@ typedef struct {
|
||||
|
||||
PyAPI_DATA(PyTypeObject) PyCode_Type;
|
||||
|
||||
#define PyCode_Check(op) (Py_Type(op) == &PyCode_Type)
|
||||
#define PyCode_Check(op) (Py_TYPE(op) == &PyCode_Type)
|
||||
#define PyCode_GetNumFree(op) (PyTuple_GET_SIZE((op)->co_freevars))
|
||||
|
||||
/* Public interface */
|
||||
@@ -72,7 +72,7 @@ PyAPI_FUNC(int) PyCode_Addr2Line(PyCodeObject *, int);
|
||||
|
||||
/* for internal use only */
|
||||
#define _PyCode_GETCODEPTR(co, pp) \
|
||||
((*Py_Type((co)->co_code)->tp_as_buffer->bf_getreadbuffer) \
|
||||
((*Py_TYPE((co)->co_code)->tp_as_buffer->bf_getreadbuffer) \
|
||||
((co)->co_code, 0, (void **)(pp)))
|
||||
|
||||
typedef struct _addr_pair {
|
||||
|
||||
@@ -43,7 +43,7 @@ typedef struct {
|
||||
PyAPI_DATA(PyTypeObject) PyComplex_Type;
|
||||
|
||||
#define PyComplex_Check(op) PyObject_TypeCheck(op, &PyComplex_Type)
|
||||
#define PyComplex_CheckExact(op) (Py_Type(op) == &PyComplex_Type)
|
||||
#define PyComplex_CheckExact(op) (Py_TYPE(op) == &PyComplex_Type)
|
||||
|
||||
PyAPI_FUNC(PyObject *) PyComplex_FromCComplex(Py_complex);
|
||||
PyAPI_FUNC(PyObject *) PyComplex_FromDoubles(double real, double imag);
|
||||
|
||||
@@ -166,19 +166,19 @@ typedef struct {
|
||||
|
||||
/* Macros for type checking when building the Python core. */
|
||||
#define PyDate_Check(op) PyObject_TypeCheck(op, &PyDateTime_DateType)
|
||||
#define PyDate_CheckExact(op) (Py_Type(op) == &PyDateTime_DateType)
|
||||
#define PyDate_CheckExact(op) (Py_TYPE(op) == &PyDateTime_DateType)
|
||||
|
||||
#define PyDateTime_Check(op) PyObject_TypeCheck(op, &PyDateTime_DateTimeType)
|
||||
#define PyDateTime_CheckExact(op) (Py_Type(op) == &PyDateTime_DateTimeType)
|
||||
#define PyDateTime_CheckExact(op) (Py_TYPE(op) == &PyDateTime_DateTimeType)
|
||||
|
||||
#define PyTime_Check(op) PyObject_TypeCheck(op, &PyDateTime_TimeType)
|
||||
#define PyTime_CheckExact(op) (Py_Type(op) == &PyDateTime_TimeType)
|
||||
#define PyTime_CheckExact(op) (Py_TYPE(op) == &PyDateTime_TimeType)
|
||||
|
||||
#define PyDelta_Check(op) PyObject_TypeCheck(op, &PyDateTime_DeltaType)
|
||||
#define PyDelta_CheckExact(op) (Py_Type(op) == &PyDateTime_DeltaType)
|
||||
#define PyDelta_CheckExact(op) (Py_TYPE(op) == &PyDateTime_DeltaType)
|
||||
|
||||
#define PyTZInfo_Check(op) PyObject_TypeCheck(op, &PyDateTime_TZInfoType)
|
||||
#define PyTZInfo_CheckExact(op) (Py_Type(op) == &PyDateTime_TZInfoType)
|
||||
#define PyTZInfo_CheckExact(op) (Py_TYPE(op) == &PyDateTime_TZInfoType)
|
||||
|
||||
#else
|
||||
|
||||
@@ -198,19 +198,19 @@ static PyDateTime_CAPI *PyDateTimeAPI;
|
||||
|
||||
/* Macros for type checking when not building the Python core. */
|
||||
#define PyDate_Check(op) PyObject_TypeCheck(op, PyDateTimeAPI->DateType)
|
||||
#define PyDate_CheckExact(op) (Py_Type(op) == PyDateTimeAPI->DateType)
|
||||
#define PyDate_CheckExact(op) (Py_TYPE(op) == PyDateTimeAPI->DateType)
|
||||
|
||||
#define PyDateTime_Check(op) PyObject_TypeCheck(op, PyDateTimeAPI->DateTimeType)
|
||||
#define PyDateTime_CheckExact(op) (Py_Type(op) == PyDateTimeAPI->DateTimeType)
|
||||
#define PyDateTime_CheckExact(op) (Py_TYPE(op) == PyDateTimeAPI->DateTimeType)
|
||||
|
||||
#define PyTime_Check(op) PyObject_TypeCheck(op, PyDateTimeAPI->TimeType)
|
||||
#define PyTime_CheckExact(op) (Py_Type(op) == PyDateTimeAPI->TimeType)
|
||||
#define PyTime_CheckExact(op) (Py_TYPE(op) == PyDateTimeAPI->TimeType)
|
||||
|
||||
#define PyDelta_Check(op) PyObject_TypeCheck(op, PyDateTimeAPI->DeltaType)
|
||||
#define PyDelta_CheckExact(op) (Py_Type(op) == PyDateTimeAPI->DeltaType)
|
||||
#define PyDelta_CheckExact(op) (Py_TYPE(op) == PyDateTimeAPI->DeltaType)
|
||||
|
||||
#define PyTZInfo_Check(op) PyObject_TypeCheck(op, PyDateTimeAPI->TZInfoType)
|
||||
#define PyTZInfo_CheckExact(op) (Py_Type(op) == PyDateTimeAPI->TZInfoType)
|
||||
#define PyTZInfo_CheckExact(op) (Py_TYPE(op) == PyDateTimeAPI->TZInfoType)
|
||||
|
||||
/* Macros for accessing constructors in a simplified fashion. */
|
||||
#define PyDate_FromDate(year, month, day) \
|
||||
|
||||
@@ -82,7 +82,7 @@ PyAPI_FUNC(PyObject *) PyDescr_NewGetSet(PyTypeObject *,
|
||||
struct PyGetSetDef *);
|
||||
PyAPI_FUNC(PyObject *) PyDescr_NewWrapper(PyTypeObject *,
|
||||
struct wrapperbase *, void *);
|
||||
#define PyDescr_IsData(d) (Py_Type(d)->tp_descr_set != NULL)
|
||||
#define PyDescr_IsData(d) (Py_TYPE(d)->tp_descr_set != NULL)
|
||||
|
||||
PyAPI_FUNC(PyObject *) PyDictProxy_New(PyObject *);
|
||||
PyAPI_FUNC(PyObject *) PyWrapper_New(PyObject *, PyObject *);
|
||||
|
||||
@@ -97,11 +97,11 @@ PyAPI_DATA(PyTypeObject) PyDictItems_Type;
|
||||
PyAPI_DATA(PyTypeObject) PyDictValues_Type;
|
||||
|
||||
#define PyDict_Check(op) \
|
||||
PyType_FastSubclass(Py_Type(op), Py_TPFLAGS_DICT_SUBCLASS)
|
||||
#define PyDict_CheckExact(op) (Py_Type(op) == &PyDict_Type)
|
||||
#define PyDictKeys_Check(op) (Py_Type(op) == &PyDictKeys_Type)
|
||||
#define PyDictItems_Check(op) (Py_Type(op) == &PyDictItems_Type)
|
||||
#define PyDictValues_Check(op) (Py_Type(op) == &PyDictValues_Type)
|
||||
PyType_FastSubclass(Py_TYPE(op), Py_TPFLAGS_DICT_SUBCLASS)
|
||||
#define PyDict_CheckExact(op) (Py_TYPE(op) == &PyDict_Type)
|
||||
#define PyDictKeys_Check(op) (Py_TYPE(op) == &PyDictKeys_Type)
|
||||
#define PyDictItems_Check(op) (Py_TYPE(op) == &PyDictItems_Type)
|
||||
#define PyDictValues_Check(op) (Py_TYPE(op) == &PyDictValues_Type)
|
||||
/* This excludes Values, since they are not sets. */
|
||||
# define PyDictViewSet_Check(op) \
|
||||
(PyDictKeys_Check(op) || PyDictItems_Check(op))
|
||||
|
||||
@@ -19,7 +19,7 @@ typedef struct {
|
||||
PyAPI_DATA(PyTypeObject) PyFloat_Type;
|
||||
|
||||
#define PyFloat_Check(op) PyObject_TypeCheck(op, &PyFloat_Type)
|
||||
#define PyFloat_CheckExact(op) (Py_Type(op) == &PyFloat_Type)
|
||||
#define PyFloat_CheckExact(op) (Py_TYPE(op) == &PyFloat_Type)
|
||||
|
||||
PyAPI_FUNC(double) PyFloat_GetMax(void);
|
||||
PyAPI_FUNC(double) PyFloat_GetMin(void);
|
||||
|
||||
@@ -51,7 +51,7 @@ typedef struct _frame {
|
||||
|
||||
PyAPI_DATA(PyTypeObject) PyFrame_Type;
|
||||
|
||||
#define PyFrame_Check(op) (Py_Type(op) == &PyFrame_Type)
|
||||
#define PyFrame_Check(op) (Py_TYPE(op) == &PyFrame_Type)
|
||||
|
||||
PyAPI_FUNC(PyFrameObject *) PyFrame_New(PyThreadState *, PyCodeObject *,
|
||||
PyObject *, PyObject *);
|
||||
|
||||
@@ -41,7 +41,7 @@ typedef struct {
|
||||
|
||||
PyAPI_DATA(PyTypeObject) PyFunction_Type;
|
||||
|
||||
#define PyFunction_Check(op) (Py_Type(op) == &PyFunction_Type)
|
||||
#define PyFunction_Check(op) (Py_TYPE(op) == &PyFunction_Type)
|
||||
|
||||
PyAPI_FUNC(PyObject *) PyFunction_New(PyObject *, PyObject *);
|
||||
PyAPI_FUNC(PyObject *) PyFunction_GetCode(PyObject *);
|
||||
|
||||
@@ -26,7 +26,7 @@ typedef struct {
|
||||
PyAPI_DATA(PyTypeObject) PyGen_Type;
|
||||
|
||||
#define PyGen_Check(op) PyObject_TypeCheck(op, &PyGen_Type)
|
||||
#define PyGen_CheckExact(op) (Py_Type(op) == &PyGen_Type)
|
||||
#define PyGen_CheckExact(op) (Py_TYPE(op) == &PyGen_Type)
|
||||
|
||||
PyAPI_FUNC(PyObject *) PyGen_New(struct _frame *);
|
||||
PyAPI_FUNC(int) PyGen_NeedsFinalizing(PyGenObject *);
|
||||
|
||||
@@ -10,12 +10,12 @@ PyAPI_DATA(PyTypeObject) PyCallIter_Type;
|
||||
PyAPI_DATA(PyTypeObject) PyZipIter_Type;
|
||||
PyAPI_DATA(PyTypeObject) PyCmpWrapper_Type;
|
||||
|
||||
#define PySeqIter_Check(op) (Py_Type(op) == &PySeqIter_Type)
|
||||
#define PySeqIter_Check(op) (Py_TYPE(op) == &PySeqIter_Type)
|
||||
|
||||
PyAPI_FUNC(PyObject *) PySeqIter_New(PyObject *);
|
||||
|
||||
|
||||
#define PyCallIter_Check(op) (Py_Type(op) == &PyCallIter_Type)
|
||||
#define PyCallIter_Check(op) (Py_TYPE(op) == &PyCallIter_Type)
|
||||
|
||||
PyAPI_FUNC(PyObject *) PyCallIter_New(PyObject *, PyObject *);
|
||||
|
||||
|
||||
@@ -44,8 +44,8 @@ PyAPI_DATA(PyTypeObject) PyListRevIter_Type;
|
||||
PyAPI_DATA(PyTypeObject) PySortWrapper_Type;
|
||||
|
||||
#define PyList_Check(op) \
|
||||
PyType_FastSubclass(Py_Type(op), Py_TPFLAGS_LIST_SUBCLASS)
|
||||
#define PyList_CheckExact(op) (Py_Type(op) == &PyList_Type)
|
||||
PyType_FastSubclass(Py_TYPE(op), Py_TPFLAGS_LIST_SUBCLASS)
|
||||
#define PyList_CheckExact(op) (Py_TYPE(op) == &PyList_Type)
|
||||
|
||||
PyAPI_FUNC(PyObject *) PyList_New(Py_ssize_t size);
|
||||
PyAPI_FUNC(Py_ssize_t) PyList_Size(PyObject *);
|
||||
@@ -63,7 +63,7 @@ PyAPI_FUNC(PyObject *) _PyList_Extend(PyListObject *, PyObject *);
|
||||
/* Macro, trading safety for speed */
|
||||
#define PyList_GET_ITEM(op, i) (((PyListObject *)(op))->ob_item[i])
|
||||
#define PyList_SET_ITEM(op, i, v) (((PyListObject *)(op))->ob_item[i] = (v))
|
||||
#define PyList_GET_SIZE(op) Py_Size(op)
|
||||
#define PyList_GET_SIZE(op) Py_SIZE(op)
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -12,8 +12,8 @@ typedef struct _longobject PyLongObject; /* Revealed in longintrepr.h */
|
||||
PyAPI_DATA(PyTypeObject) PyLong_Type;
|
||||
|
||||
#define PyLong_Check(op) \
|
||||
PyType_FastSubclass(Py_Type(op), Py_TPFLAGS_LONG_SUBCLASS)
|
||||
#define PyLong_CheckExact(op) (Py_Type(op) == &PyLong_Type)
|
||||
PyType_FastSubclass(Py_TYPE(op), Py_TPFLAGS_LONG_SUBCLASS)
|
||||
#define PyLong_CheckExact(op) (Py_TYPE(op) == &PyLong_Type)
|
||||
|
||||
PyAPI_FUNC(PyObject *) PyLong_FromLong(long);
|
||||
PyAPI_FUNC(PyObject *) PyLong_FromUnsignedLong(unsigned long);
|
||||
|
||||
@@ -16,7 +16,7 @@ typedef struct {
|
||||
|
||||
PyAPI_DATA(PyTypeObject) PyMemoryView_Type;
|
||||
|
||||
#define PyMemory_Check(op) (Py_Type(op) == &PyMemoryView_Type)
|
||||
#define PyMemory_Check(op) (Py_TYPE(op) == &PyMemoryView_Type)
|
||||
#define PyMemoryView(op) (((PyMemoryViewObject *)(op))->view)
|
||||
|
||||
#define Py_END_OF_MEMORY (-1)
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user