mirror of https://github.com/python/cpython
#1629: Renamed Py_Size, Py_Type and Py_Refcnt to Py_SIZE, Py_TYPE and Py_REFCNT.
This commit is contained in:
parent
99170a5dbf
commit
90aa7646af
|
@ -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)
|
||||
|
|
|
@ -13,7 +13,7 @@ extern "C" {
|
|||
|
||||
PyAPI_DATA(PyTypeObject) PyCFunction_Type;
|
||||
|
||||
#define PyCFunction_Check(op) (Py_Type(op) == &PyCFunction_Type)
|
||||
#define PyCFunction_Check(op) (Py_TYPE(op) == &PyCFunction_Type)
|
||||
|
||||
typedef PyObject *(*PyCFunction)(PyObject *, PyObject *);
|
||||
typedef PyObject *(*PyCFunctionWithKeywords)(PyObject *, PyObject *,
|
||||
|
|
|
@ -10,7 +10,7 @@ extern "C" {
|
|||
PyAPI_DATA(PyTypeObject) PyModule_Type;
|
||||
|
||||
#define PyModule_Check(op) PyObject_TypeCheck(op, &PyModule_Type)
|
||||
#define PyModule_CheckExact(op) (Py_Type(op) == &PyModule_Type)
|
||||
#define PyModule_CheckExact(op) (Py_TYPE(op) == &PyModule_Type)
|
||||
|
||||
PyAPI_FUNC(PyObject *) PyModule_New(const char *);
|
||||
PyAPI_FUNC(PyObject *) PyModule_GetDict(PyObject *);
|
||||
|
|
|
@ -109,9 +109,9 @@ typedef struct {
|
|||
Py_ssize_t ob_size; /* Number of items in variable part */
|
||||
} PyVarObject;
|
||||
|
||||
#define Py_Refcnt(ob) (((PyObject*)(ob))->ob_refcnt)
|
||||
#define Py_Type(ob) (((PyObject*)(ob))->ob_type)
|
||||
#define Py_Size(ob) (((PyVarObject*)(ob))->ob_size)
|
||||
#define Py_REFCNT(ob) (((PyObject*)(ob))->ob_refcnt)
|
||||
#define Py_TYPE(ob) (((PyObject*)(ob))->ob_type)
|
||||
#define Py_SIZE(ob) (((PyVarObject*)(ob))->ob_size)
|
||||
|
||||
/*
|
||||
Type objects contain a string containing the type name (to help somewhat
|
||||
|
@ -404,21 +404,21 @@ typedef struct _heaptypeobject {
|
|||
|
||||
/* access macro to the members which are floating "behind" the object */
|
||||
#define PyHeapType_GET_MEMBERS(etype) \
|
||||
((PyMemberDef *)(((char *)etype) + Py_Type(etype)->tp_basicsize))
|
||||
((PyMemberDef *)(((char *)etype) + Py_TYPE(etype)->tp_basicsize))
|
||||
|
||||
|
||||
/* Generic type check */
|
||||
PyAPI_FUNC(int) PyType_IsSubtype(PyTypeObject *, PyTypeObject *);
|
||||
#define PyObject_TypeCheck(ob, tp) \
|
||||
(Py_Type(ob) == (tp) || PyType_IsSubtype(Py_Type(ob), (tp)))
|
||||
(Py_TYPE(ob) == (tp) || PyType_IsSubtype(Py_TYPE(ob), (tp)))
|
||||
|
||||
PyAPI_DATA(PyTypeObject) PyType_Type; /* built-in 'type' */
|
||||
PyAPI_DATA(PyTypeObject) PyBaseObject_Type; /* built-in 'object' */
|
||||
PyAPI_DATA(PyTypeObject) PySuper_Type; /* built-in 'super' */
|
||||
|
||||
#define PyType_Check(op) \
|
||||
PyType_FastSubclass(Py_Type(op), Py_TPFLAGS_TYPE_SUBCLASS)
|
||||
#define PyType_CheckExact(op) (Py_Type(op) == &PyType_Type)
|
||||
PyType_FastSubclass(Py_TYPE(op), Py_TPFLAGS_TYPE_SUBCLASS)
|
||||
#define PyType_CheckExact(op) (Py_TYPE(op) == &PyType_Type)
|
||||
|
||||
PyAPI_FUNC(int) PyType_Ready(PyTypeObject *);
|
||||
PyAPI_FUNC(PyObject *) PyType_GenericAlloc(PyTypeObject *, Py_ssize_t);
|
||||
|
@ -612,9 +612,9 @@ PyAPI_FUNC(Py_ssize_t) _Py_GetRefTotal(void);
|
|||
#ifdef COUNT_ALLOCS
|
||||
PyAPI_FUNC(void) inc_count(PyTypeObject *);
|
||||
PyAPI_FUNC(void) dec_count(PyTypeObject *);
|
||||
#define _Py_INC_TPALLOCS(OP) inc_count(Py_Type(OP))
|
||||
#define _Py_INC_TPFREES(OP) dec_count(Py_Type(OP))
|
||||
#define _Py_DEC_TPFREES(OP) Py_Type(OP)->tp_frees--
|
||||
#define _Py_INC_TPALLOCS(OP) inc_count(Py_TYPE(OP))
|
||||
#define _Py_INC_TPFREES(OP) dec_count(Py_TYPE(OP))
|
||||
#define _Py_DEC_TPFREES(OP) Py_TYPE(OP)->tp_frees--
|
||||
#define _Py_COUNT_ALLOCS_COMMA ,
|
||||
#else
|
||||
#define _Py_INC_TPALLOCS(OP)
|
||||
|
@ -639,13 +639,13 @@ PyAPI_FUNC(void) _Py_AddToAllObjects(PyObject *, int force);
|
|||
#define _Py_NewReference(op) ( \
|
||||
_Py_INC_TPALLOCS(op) _Py_COUNT_ALLOCS_COMMA \
|
||||
_Py_INC_REFTOTAL _Py_REF_DEBUG_COMMA \
|
||||
Py_Refcnt(op) = 1)
|
||||
Py_REFCNT(op) = 1)
|
||||
|
||||
#define _Py_ForgetReference(op) _Py_INC_TPFREES(op)
|
||||
|
||||
#define _Py_Dealloc(op) ( \
|
||||
_Py_INC_TPFREES(op) _Py_COUNT_ALLOCS_COMMA \
|
||||
(*Py_Type(op)->tp_dealloc)((PyObject *)(op)))
|
||||
(*Py_TYPE(op)->tp_dealloc)((PyObject *)(op)))
|
||||
#endif /* !Py_TRACE_REFS */
|
||||
|
||||
#define Py_INCREF(op) ( \
|
||||
|
|
|
@ -151,9 +151,9 @@ PyAPI_FUNC(PyVarObject *) _PyObject_NewVar(PyTypeObject *, Py_ssize_t);
|
|||
/* Macros trading binary compatibility for speed. See also pymem.h.
|
||||
Note that these macros expect non-NULL object pointers.*/
|
||||
#define PyObject_INIT(op, typeobj) \
|
||||
( Py_Type(op) = (typeobj), _Py_NewReference((PyObject *)(op)), (op) )
|
||||
( Py_TYPE(op) = (typeobj), _Py_NewReference((PyObject *)(op)), (op) )
|
||||
#define PyObject_INIT_VAR(op, typeobj, size) \
|
||||
( Py_Size(op) = (size), PyObject_INIT((op), (typeobj)) )
|
||||
( Py_SIZE(op) = (size), PyObject_INIT((op), (typeobj)) )
|
||||
|
||||
#define _PyObject_SIZE(typeobj) ( (typeobj)->tp_basicsize )
|
||||
|
||||
|
@ -228,8 +228,8 @@ PyAPI_FUNC(Py_ssize_t) PyGC_Collect(void);
|
|||
#define PyType_IS_GC(t) PyType_HasFeature((t), Py_TPFLAGS_HAVE_GC)
|
||||
|
||||
/* Test if an object has a GC head */
|
||||
#define PyObject_IS_GC(o) (PyType_IS_GC(Py_Type(o)) && \
|
||||
(Py_Type(o)->tp_is_gc == NULL || Py_Type(o)->tp_is_gc(o)))
|
||||
#define PyObject_IS_GC(o) (PyType_IS_GC(Py_TYPE(o)) && \
|
||||
(Py_TYPE(o)->tp_is_gc == NULL || Py_TYPE(o)->tp_is_gc(o)))
|
||||
|
||||
PyAPI_FUNC(PyVarObject *) _PyObject_GC_Resize(PyVarObject *, Py_ssize_t);
|
||||
#define PyObject_GC_Resize(type, op, n) \
|
||||
|
@ -323,7 +323,7 @@ PyAPI_FUNC(void) PyObject_GC_Del(void *);
|
|||
#define PyType_SUPPORTS_WEAKREFS(t) ((t)->tp_weaklistoffset > 0)
|
||||
|
||||
#define PyObject_GET_WEAKREFS_LISTPTR(o) \
|
||||
((PyObject **) (((char *) (o)) + Py_Type(o)->tp_weaklistoffset))
|
||||
((PyObject **) (((char *) (o)) + Py_TYPE(o)->tp_weaklistoffset))
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
@ -73,7 +73,7 @@ typedef struct {
|
|||
WINDOW *win;
|
||||
} PyCursesWindowObject;
|
||||
|
||||
#define PyCursesWindow_Check(v) (Py_Type(v) == &PyCursesWindow_Type)
|
||||
#define PyCursesWindow_Check(v) (Py_TYPE(v) == &PyCursesWindow_Type)
|
||||
|
||||
#ifdef CURSES_MODULE
|
||||
/* This section is used when compiling _cursesmodule.c */
|
||||
|
|
|
@ -19,7 +19,7 @@ PyAPI_DATA(PyTypeObject) PyRange_Type;
|
|||
PyAPI_DATA(PyTypeObject) PyRangeIter_Type;
|
||||
PyAPI_DATA(PyTypeObject) PyLongRangeIter_Type;
|
||||
|
||||
#define PyRange_Check(op) (Py_Type(op) == &PyRange_Type)
|
||||
#define PyRange_Check(op) (Py_TYPE(op) == &PyRange_Type)
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
@ -67,13 +67,13 @@ PyAPI_DATA(PyTypeObject) PySetIter_Type;
|
|||
* hash is -1
|
||||
*/
|
||||
|
||||
#define PyFrozenSet_CheckExact(ob) (Py_Type(ob) == &PyFrozenSet_Type)
|
||||
#define PyFrozenSet_CheckExact(ob) (Py_TYPE(ob) == &PyFrozenSet_Type)
|
||||
#define PyAnySet_CheckExact(ob) \
|
||||
(Py_Type(ob) == &PySet_Type || Py_Type(ob) == &PyFrozenSet_Type)
|
||||
(Py_TYPE(ob) == &PySet_Type || Py_TYPE(ob) == &PyFrozenSet_Type)
|
||||
#define PyAnySet_Check(ob) \
|
||||
(Py_Type(ob) == &PySet_Type || Py_Type(ob) == &PyFrozenSet_Type || \
|
||||
PyType_IsSubtype(Py_Type(ob), &PySet_Type) || \
|
||||
PyType_IsSubtype(Py_Type(ob), &PyFrozenSet_Type))
|
||||
(Py_TYPE(ob) == &PySet_Type || Py_TYPE(ob) == &PyFrozenSet_Type || \
|
||||
PyType_IsSubtype(Py_TYPE(ob), &PySet_Type) || \
|
||||
PyType_IsSubtype(Py_TYPE(ob), &PyFrozenSet_Type))
|
||||
|
||||
PyAPI_FUNC(PyObject *) PySet_New(PyObject *);
|
||||
PyAPI_FUNC(PyObject *) PyFrozenSet_New(PyObject *);
|
||||
|
|
|
@ -26,7 +26,7 @@ typedef struct {
|
|||
|
||||
PyAPI_DATA(PyTypeObject) PySlice_Type;
|
||||
|
||||
#define PySlice_Check(op) (Py_Type(op) == &PySlice_Type)
|
||||
#define PySlice_Check(op) (Py_TYPE(op) == &PySlice_Type)
|
||||
|
||||
PyAPI_FUNC(PyObject *) PySlice_New(PyObject* start, PyObject* stop,
|
||||
PyObject* step);
|
||||
|
|
|
@ -43,8 +43,8 @@ PyAPI_DATA(PyTypeObject) PyString_Type;
|
|||
PyAPI_DATA(PyTypeObject) PyStringIter_Type;
|
||||
|
||||
#define PyString_Check(op) \
|
||||
PyType_FastSubclass(Py_Type(op), Py_TPFLAGS_STRING_SUBCLASS)
|
||||
#define PyString_CheckExact(op) (Py_Type(op) == &PyString_Type)
|
||||
PyType_FastSubclass(Py_TYPE(op), Py_TPFLAGS_STRING_SUBCLASS)
|
||||
#define PyString_CheckExact(op) (Py_TYPE(op) == &PyString_Type)
|
||||
|
||||
PyAPI_FUNC(PyObject *) PyString_FromStringAndSize(const char *, Py_ssize_t);
|
||||
PyAPI_FUNC(PyObject *) PyString_FromString(const char *);
|
||||
|
@ -68,7 +68,7 @@ PyAPI_FUNC(PyObject *) PyString_DecodeEscape(const char *, Py_ssize_t,
|
|||
/* Macro, trading safety for speed */
|
||||
#define PyString_AS_STRING(op) (assert(PyString_Check(op)), \
|
||||
(((PyStringObject *)(op))->ob_sval))
|
||||
#define PyString_GET_SIZE(op) (assert(PyString_Check(op)),Py_Size(op))
|
||||
#define PyString_GET_SIZE(op) (assert(PyString_Check(op)),Py_SIZE(op))
|
||||
|
||||
/* _PyString_Join(sep, x) is like sep.join(x). sep must be PyStringObject*,
|
||||
x must be an iterable object. */
|
||||
|
|
|
@ -53,7 +53,7 @@ typedef struct _symtable_entry {
|
|||
|
||||
PyAPI_DATA(PyTypeObject) PySTEntry_Type;
|
||||
|
||||
#define PySTEntry_Check(op) (Py_Type(op) == &PySTEntry_Type)
|
||||
#define PySTEntry_Check(op) (Py_TYPE(op) == &PySTEntry_Type)
|
||||
|
||||
PyAPI_FUNC(int) PyST_GetScope(PySTEntryObject *, PyObject *);
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ PyAPI_FUNC(int) PyTraceBack_Print(PyObject *, PyObject *);
|
|||
|
||||
/* Reveal traceback type so we can typecheck traceback objects */
|
||||
PyAPI_DATA(PyTypeObject) PyTraceBack_Type;
|
||||
#define PyTraceBack_Check(v) (Py_Type(v) == &PyTraceBack_Type)
|
||||
#define PyTraceBack_Check(v) (Py_TYPE(v) == &PyTraceBack_Type)
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
@ -35,8 +35,8 @@ PyAPI_DATA(PyTypeObject) PyTuple_Type;
|
|||
PyAPI_DATA(PyTypeObject) PyTupleIter_Type;
|
||||
|
||||
#define PyTuple_Check(op) \
|
||||
PyType_FastSubclass(Py_Type(op), Py_TPFLAGS_TUPLE_SUBCLASS)
|
||||
#define PyTuple_CheckExact(op) (Py_Type(op) == &PyTuple_Type)
|
||||
PyType_FastSubclass(Py_TYPE(op), Py_TPFLAGS_TUPLE_SUBCLASS)
|
||||
#define PyTuple_CheckExact(op) (Py_TYPE(op) == &PyTuple_Type)
|
||||
|
||||
PyAPI_FUNC(PyObject *) PyTuple_New(Py_ssize_t size);
|
||||
PyAPI_FUNC(Py_ssize_t) PyTuple_Size(PyObject *);
|
||||
|
@ -48,7 +48,7 @@ PyAPI_FUNC(PyObject *) PyTuple_Pack(Py_ssize_t, ...);
|
|||
|
||||
/* Macro, trading safety for speed */
|
||||
#define PyTuple_GET_ITEM(op, i) (((PyTupleObject *)(op))->ob_item[i])
|
||||
#define PyTuple_GET_SIZE(op) Py_Size(op)
|
||||
#define PyTuple_GET_SIZE(op) Py_SIZE(op)
|
||||
|
||||
/* Macro, *only* to be used to fill in brand new tuples */
|
||||
#define PyTuple_SET_ITEM(op, i, v) (((PyTupleObject *)(op))->ob_item[i] = v)
|
||||
|
|
|
@ -424,8 +424,8 @@ PyAPI_DATA(PyTypeObject) PyUnicodeIter_Type;
|
|||
#define SSTATE_INTERNED_IMMORTAL 2
|
||||
|
||||
#define PyUnicode_Check(op) \
|
||||
PyType_FastSubclass(Py_Type(op), Py_TPFLAGS_UNICODE_SUBCLASS)
|
||||
#define PyUnicode_CheckExact(op) (Py_Type(op) == &PyUnicode_Type)
|
||||
PyType_FastSubclass(Py_TYPE(op), Py_TPFLAGS_UNICODE_SUBCLASS)
|
||||
#define PyUnicode_CheckExact(op) (Py_TYPE(op) == &PyUnicode_Type)
|
||||
|
||||
/* Fast access macros */
|
||||
#define PyUnicode_GET_SIZE(op) \
|
||||
|
|
|
@ -44,10 +44,10 @@ PyAPI_DATA(PyTypeObject) _PyWeakref_CallableProxyType;
|
|||
|
||||
#define PyWeakref_CheckRef(op) PyObject_TypeCheck(op, &_PyWeakref_RefType)
|
||||
#define PyWeakref_CheckRefExact(op) \
|
||||
(Py_Type(op) == &_PyWeakref_RefType)
|
||||
(Py_TYPE(op) == &_PyWeakref_RefType)
|
||||
#define PyWeakref_CheckProxy(op) \
|
||||
((Py_Type(op) == &_PyWeakref_ProxyType) || \
|
||||
(Py_Type(op) == &_PyWeakref_CallableProxyType))
|
||||
((Py_TYPE(op) == &_PyWeakref_ProxyType) || \
|
||||
(Py_TYPE(op) == &_PyWeakref_CallableProxyType))
|
||||
|
||||
/* This macro calls PyWeakref_CheckRef() last since that can involve a
|
||||
function call; this makes it more likely that the function call
|
||||
|
|
|
@ -609,7 +609,7 @@ initMacOS(void)
|
|||
MacOS_Error = PyMac_GetOSErrException();
|
||||
if (MacOS_Error == NULL || PyDict_SetItemString(d, "Error", MacOS_Error) != 0)
|
||||
return;
|
||||
Py_Type(&Rftype) = &PyType_Type;
|
||||
Py_TYPE(&Rftype) = &PyType_Type;
|
||||
Py_INCREF(&Rftype);
|
||||
if (PyDict_SetItemString(d, "ResourceForkType", (PyObject *)&Rftype) != 0)
|
||||
return;
|
||||
|
|
|
@ -47,7 +47,7 @@ static PyObject *AE_Error;
|
|||
|
||||
PyTypeObject AEDesc_Type;
|
||||
|
||||
#define AEDesc_Check(x) (Py_Type(x) == &AEDesc_Type || PyObject_TypeCheck((x), &AEDesc_Type))
|
||||
#define AEDesc_Check(x) (Py_TYPE(x) == &AEDesc_Type || PyObject_TypeCheck((x), &AEDesc_Type))
|
||||
|
||||
typedef struct AEDescObject {
|
||||
PyObject_HEAD
|
||||
|
@ -79,7 +79,7 @@ int AEDesc_Convert(PyObject *v, AEDesc *p_itself)
|
|||
static void AEDesc_dealloc(AEDescObject *self)
|
||||
{
|
||||
if (self->ob_owned) AEDisposeDesc(&self->ob_itself);
|
||||
Py_Type(self)->tp_free((PyObject *)self);
|
||||
Py_TYPE(self)->tp_free((PyObject *)self);
|
||||
}
|
||||
|
||||
static PyObject *AEDesc_AECoerceDesc(AEDescObject *_self, PyObject *_args)
|
||||
|
@ -1440,7 +1440,7 @@ void init_AE(void)
|
|||
if (AE_Error == NULL ||
|
||||
PyDict_SetItemString(d, "Error", AE_Error) != 0)
|
||||
return;
|
||||
Py_Type(&AEDesc_Type) = &PyType_Type;
|
||||
Py_TYPE(&AEDesc_Type) = &PyType_Type;
|
||||
if (PyType_Ready(&AEDesc_Type) < 0) return;
|
||||
Py_INCREF(&AEDesc_Type);
|
||||
PyModule_AddObject(m, "AEDesc", (PyObject *)&AEDesc_Type);
|
||||
|
|
|
@ -30,7 +30,7 @@ static PyObject *App_Error;
|
|||
|
||||
PyTypeObject ThemeDrawingState_Type;
|
||||
|
||||
#define ThemeDrawingStateObj_Check(x) (Py_Type(x) == &ThemeDrawingState_Type || PyObject_TypeCheck((x), &ThemeDrawingState_Type))
|
||||
#define ThemeDrawingStateObj_Check(x) (Py_TYPE(x) == &ThemeDrawingState_Type || PyObject_TypeCheck((x), &ThemeDrawingState_Type))
|
||||
|
||||
typedef struct ThemeDrawingStateObject {
|
||||
PyObject_HEAD
|
||||
|
@ -60,7 +60,7 @@ int ThemeDrawingStateObj_Convert(PyObject *v, ThemeDrawingState *p_itself)
|
|||
static void ThemeDrawingStateObj_dealloc(ThemeDrawingStateObject *self)
|
||||
{
|
||||
/* Cleanup of self->ob_itself goes here */
|
||||
Py_Type(self)->tp_free((PyObject *)self);
|
||||
Py_TYPE(self)->tp_free((PyObject *)self);
|
||||
}
|
||||
|
||||
static PyObject *ThemeDrawingStateObj_SetThemeDrawingState(ThemeDrawingStateObject *_self, PyObject *_args)
|
||||
|
@ -1807,7 +1807,7 @@ void init_App(void)
|
|||
if (App_Error == NULL ||
|
||||
PyDict_SetItemString(d, "Error", App_Error) != 0)
|
||||
return;
|
||||
Py_Type(&ThemeDrawingState_Type) = &PyType_Type;
|
||||
Py_TYPE(&ThemeDrawingState_Type) = &PyType_Type;
|
||||
if (PyType_Ready(&ThemeDrawingState_Type) < 0) return;
|
||||
Py_INCREF(&ThemeDrawingState_Type);
|
||||
PyModule_AddObject(m, "ThemeDrawingState", (PyObject *)&ThemeDrawingState_Type);
|
||||
|
|
|
@ -151,7 +151,7 @@ int EventRef_Convert(PyObject *v, EventRef *p_itself)
|
|||
static void EventRef_dealloc(EventRefObject *self)
|
||||
{
|
||||
/* Cleanup of self->ob_itself goes here */
|
||||
Py_Type(self)->tp_free((PyObject *)self);
|
||||
Py_TYPE(self)->tp_free((PyObject *)self);
|
||||
}
|
||||
|
||||
static PyObject *EventRef_RetainEvent(EventRefObject *_self, PyObject *_args)
|
||||
|
@ -495,7 +495,7 @@ int EventQueueRef_Convert(PyObject *v, EventQueueRef *p_itself)
|
|||
static void EventQueueRef_dealloc(EventQueueRefObject *self)
|
||||
{
|
||||
/* Cleanup of self->ob_itself goes here */
|
||||
Py_Type(self)->tp_free((PyObject *)self);
|
||||
Py_TYPE(self)->tp_free((PyObject *)self);
|
||||
}
|
||||
|
||||
static PyObject *EventQueueRef_PostEventToQueue(EventQueueRefObject *_self, PyObject *_args)
|
||||
|
@ -715,7 +715,7 @@ int EventLoopRef_Convert(PyObject *v, EventLoopRef *p_itself)
|
|||
static void EventLoopRef_dealloc(EventLoopRefObject *self)
|
||||
{
|
||||
/* Cleanup of self->ob_itself goes here */
|
||||
Py_Type(self)->tp_free((PyObject *)self);
|
||||
Py_TYPE(self)->tp_free((PyObject *)self);
|
||||
}
|
||||
|
||||
static PyObject *EventLoopRef_QuitEventLoop(EventLoopRefObject *_self, PyObject *_args)
|
||||
|
@ -844,7 +844,7 @@ int EventLoopTimerRef_Convert(PyObject *v, EventLoopTimerRef *p_itself)
|
|||
static void EventLoopTimerRef_dealloc(EventLoopTimerRefObject *self)
|
||||
{
|
||||
/* Cleanup of self->ob_itself goes here */
|
||||
Py_Type(self)->tp_free((PyObject *)self);
|
||||
Py_TYPE(self)->tp_free((PyObject *)self);
|
||||
}
|
||||
|
||||
static PyObject *EventLoopTimerRef_RemoveEventLoopTimer(EventLoopTimerRefObject *_self, PyObject *_args)
|
||||
|
@ -996,7 +996,7 @@ static void EventHandlerRef_dealloc(EventHandlerRefObject *self)
|
|||
RemoveEventHandler(self->ob_itself);
|
||||
Py_DECREF(self->ob_callback);
|
||||
}
|
||||
Py_Type(self)->tp_free((PyObject *)self);
|
||||
Py_TYPE(self)->tp_free((PyObject *)self);
|
||||
}
|
||||
|
||||
static PyObject *EventHandlerRef_AddEventTypesToHandler(EventHandlerRefObject *_self, PyObject *_args)
|
||||
|
@ -1183,7 +1183,7 @@ int EventHandlerCallRef_Convert(PyObject *v, EventHandlerCallRef *p_itself)
|
|||
static void EventHandlerCallRef_dealloc(EventHandlerCallRefObject *self)
|
||||
{
|
||||
/* Cleanup of self->ob_itself goes here */
|
||||
Py_Type(self)->tp_free((PyObject *)self);
|
||||
Py_TYPE(self)->tp_free((PyObject *)self);
|
||||
}
|
||||
|
||||
static PyObject *EventHandlerCallRef_CallNextEventHandler(EventHandlerCallRefObject *_self, PyObject *_args)
|
||||
|
@ -1315,7 +1315,7 @@ int EventTargetRef_Convert(PyObject *v, EventTargetRef *p_itself)
|
|||
static void EventTargetRef_dealloc(EventTargetRefObject *self)
|
||||
{
|
||||
/* Cleanup of self->ob_itself goes here */
|
||||
Py_Type(self)->tp_free((PyObject *)self);
|
||||
Py_TYPE(self)->tp_free((PyObject *)self);
|
||||
}
|
||||
|
||||
static PyObject *EventTargetRef_InstallStandardEventHandler(EventTargetRefObject *_self, PyObject *_args)
|
||||
|
@ -1469,7 +1469,7 @@ int EventHotKeyRef_Convert(PyObject *v, EventHotKeyRef *p_itself)
|
|||
static void EventHotKeyRef_dealloc(EventHotKeyRefObject *self)
|
||||
{
|
||||
/* Cleanup of self->ob_itself goes here */
|
||||
Py_Type(self)->tp_free((PyObject *)self);
|
||||
Py_TYPE(self)->tp_free((PyObject *)self);
|
||||
}
|
||||
|
||||
static PyObject *EventHotKeyRef_UnregisterEventHotKey(EventHotKeyRefObject *_self, PyObject *_args)
|
||||
|
@ -2152,56 +2152,56 @@ void init_CarbonEvt(void)
|
|||
if (CarbonEvents_Error == NULL ||
|
||||
PyDict_SetItemString(d, "Error", CarbonEvents_Error) != 0)
|
||||
return;
|
||||
Py_Type(&EventRef_Type) = &PyType_Type;
|
||||
Py_TYPE(&EventRef_Type) = &PyType_Type;
|
||||
if (PyType_Ready(&EventRef_Type) < 0) return;
|
||||
Py_INCREF(&EventRef_Type);
|
||||
PyModule_AddObject(m, "EventRef", (PyObject *)&EventRef_Type);
|
||||
/* Backward-compatible name */
|
||||
Py_INCREF(&EventRef_Type);
|
||||
PyModule_AddObject(m, "EventRefType", (PyObject *)&EventRef_Type);
|
||||
Py_Type(&EventQueueRef_Type) = &PyType_Type;
|
||||
Py_TYPE(&EventQueueRef_Type) = &PyType_Type;
|
||||
if (PyType_Ready(&EventQueueRef_Type) < 0) return;
|
||||
Py_INCREF(&EventQueueRef_Type);
|
||||
PyModule_AddObject(m, "EventQueueRef", (PyObject *)&EventQueueRef_Type);
|
||||
/* Backward-compatible name */
|
||||
Py_INCREF(&EventQueueRef_Type);
|
||||
PyModule_AddObject(m, "EventQueueRefType", (PyObject *)&EventQueueRef_Type);
|
||||
Py_Type(&EventLoopRef_Type) = &PyType_Type;
|
||||
Py_TYPE(&EventLoopRef_Type) = &PyType_Type;
|
||||
if (PyType_Ready(&EventLoopRef_Type) < 0) return;
|
||||
Py_INCREF(&EventLoopRef_Type);
|
||||
PyModule_AddObject(m, "EventLoopRef", (PyObject *)&EventLoopRef_Type);
|
||||
/* Backward-compatible name */
|
||||
Py_INCREF(&EventLoopRef_Type);
|
||||
PyModule_AddObject(m, "EventLoopRefType", (PyObject *)&EventLoopRef_Type);
|
||||
Py_Type(&EventLoopTimerRef_Type) = &PyType_Type;
|
||||
Py_TYPE(&EventLoopTimerRef_Type) = &PyType_Type;
|
||||
if (PyType_Ready(&EventLoopTimerRef_Type) < 0) return;
|
||||
Py_INCREF(&EventLoopTimerRef_Type);
|
||||
PyModule_AddObject(m, "EventLoopTimerRef", (PyObject *)&EventLoopTimerRef_Type);
|
||||
/* Backward-compatible name */
|
||||
Py_INCREF(&EventLoopTimerRef_Type);
|
||||
PyModule_AddObject(m, "EventLoopTimerRefType", (PyObject *)&EventLoopTimerRef_Type);
|
||||
Py_Type(&EventHandlerRef_Type) = &PyType_Type;
|
||||
Py_TYPE(&EventHandlerRef_Type) = &PyType_Type;
|
||||
if (PyType_Ready(&EventHandlerRef_Type) < 0) return;
|
||||
Py_INCREF(&EventHandlerRef_Type);
|
||||
PyModule_AddObject(m, "EventHandlerRef", (PyObject *)&EventHandlerRef_Type);
|
||||
/* Backward-compatible name */
|
||||
Py_INCREF(&EventHandlerRef_Type);
|
||||
PyModule_AddObject(m, "EventHandlerRefType", (PyObject *)&EventHandlerRef_Type);
|
||||
Py_Type(&EventHandlerCallRef_Type) = &PyType_Type;
|
||||
Py_TYPE(&EventHandlerCallRef_Type) = &PyType_Type;
|
||||
if (PyType_Ready(&EventHandlerCallRef_Type) < 0) return;
|
||||
Py_INCREF(&EventHandlerCallRef_Type);
|
||||
PyModule_AddObject(m, "EventHandlerCallRef", (PyObject *)&EventHandlerCallRef_Type);
|
||||
/* Backward-compatible name */
|
||||
Py_INCREF(&EventHandlerCallRef_Type);
|
||||
PyModule_AddObject(m, "EventHandlerCallRefType", (PyObject *)&EventHandlerCallRef_Type);
|
||||
Py_Type(&EventTargetRef_Type) = &PyType_Type;
|
||||
Py_TYPE(&EventTargetRef_Type) = &PyType_Type;
|
||||
if (PyType_Ready(&EventTargetRef_Type) < 0) return;
|
||||
Py_INCREF(&EventTargetRef_Type);
|
||||
PyModule_AddObject(m, "EventTargetRef", (PyObject *)&EventTargetRef_Type);
|
||||
/* Backward-compatible name */
|
||||
Py_INCREF(&EventTargetRef_Type);
|
||||
PyModule_AddObject(m, "EventTargetRefType", (PyObject *)&EventTargetRef_Type);
|
||||
Py_Type(&EventHotKeyRef_Type) = &PyType_Type;
|
||||
Py_TYPE(&EventHotKeyRef_Type) = &PyType_Type;
|
||||
if (PyType_Ready(&EventHotKeyRef_Type) < 0) return;
|
||||
Py_INCREF(&EventHotKeyRef_Type);
|
||||
PyModule_AddObject(m, "EventHotKeyRef", (PyObject *)&EventHotKeyRef_Type);
|
||||
|
|
|
@ -116,7 +116,7 @@ static PyObject *CF_Error;
|
|||
|
||||
PyTypeObject CFTypeRef_Type;
|
||||
|
||||
#define CFTypeRefObj_Check(x) (Py_Type(x) == &CFTypeRef_Type || PyObject_TypeCheck((x), &CFTypeRef_Type))
|
||||
#define CFTypeRefObj_Check(x) (Py_TYPE(x) == &CFTypeRef_Type || PyObject_TypeCheck((x), &CFTypeRef_Type))
|
||||
|
||||
typedef struct CFTypeRefObject {
|
||||
PyObject_HEAD
|
||||
|
@ -161,7 +161,7 @@ static void CFTypeRefObj_dealloc(CFTypeRefObject *self)
|
|||
self->ob_freeit((CFTypeRef)self->ob_itself);
|
||||
self->ob_itself = NULL;
|
||||
}
|
||||
Py_Type(self)->tp_free((PyObject *)self);
|
||||
Py_TYPE(self)->tp_free((PyObject *)self);
|
||||
}
|
||||
|
||||
static PyObject *CFTypeRefObj_CFGetTypeID(CFTypeRefObject *_self, PyObject *_args)
|
||||
|
@ -477,7 +477,7 @@ PyTypeObject CFTypeRef_Type = {
|
|||
|
||||
PyTypeObject CFArrayRef_Type;
|
||||
|
||||
#define CFArrayRefObj_Check(x) (Py_Type(x) == &CFArrayRef_Type || PyObject_TypeCheck((x), &CFArrayRef_Type))
|
||||
#define CFArrayRefObj_Check(x) (Py_TYPE(x) == &CFArrayRef_Type || PyObject_TypeCheck((x), &CFArrayRef_Type))
|
||||
|
||||
typedef struct CFArrayRefObject {
|
||||
PyObject_HEAD
|
||||
|
@ -687,7 +687,7 @@ PyTypeObject CFArrayRef_Type = {
|
|||
|
||||
PyTypeObject CFMutableArrayRef_Type;
|
||||
|
||||
#define CFMutableArrayRefObj_Check(x) (Py_Type(x) == &CFMutableArrayRef_Type || PyObject_TypeCheck((x), &CFMutableArrayRef_Type))
|
||||
#define CFMutableArrayRefObj_Check(x) (Py_TYPE(x) == &CFMutableArrayRef_Type || PyObject_TypeCheck((x), &CFMutableArrayRef_Type))
|
||||
|
||||
typedef struct CFMutableArrayRefObject {
|
||||
PyObject_HEAD
|
||||
|
@ -926,7 +926,7 @@ PyTypeObject CFMutableArrayRef_Type = {
|
|||
|
||||
PyTypeObject CFDictionaryRef_Type;
|
||||
|
||||
#define CFDictionaryRefObj_Check(x) (Py_Type(x) == &CFDictionaryRef_Type || PyObject_TypeCheck((x), &CFDictionaryRef_Type))
|
||||
#define CFDictionaryRefObj_Check(x) (Py_TYPE(x) == &CFDictionaryRef_Type || PyObject_TypeCheck((x), &CFDictionaryRef_Type))
|
||||
|
||||
typedef struct CFDictionaryRefObject {
|
||||
PyObject_HEAD
|
||||
|
@ -1118,7 +1118,7 @@ PyTypeObject CFDictionaryRef_Type = {
|
|||
|
||||
PyTypeObject CFMutableDictionaryRef_Type;
|
||||
|
||||
#define CFMutableDictionaryRefObj_Check(x) (Py_Type(x) == &CFMutableDictionaryRef_Type || PyObject_TypeCheck((x), &CFMutableDictionaryRef_Type))
|
||||
#define CFMutableDictionaryRefObj_Check(x) (Py_TYPE(x) == &CFMutableDictionaryRef_Type || PyObject_TypeCheck((x), &CFMutableDictionaryRef_Type))
|
||||
|
||||
typedef struct CFMutableDictionaryRefObject {
|
||||
PyObject_HEAD
|
||||
|
@ -1294,7 +1294,7 @@ PyTypeObject CFMutableDictionaryRef_Type = {
|
|||
|
||||
PyTypeObject CFDataRef_Type;
|
||||
|
||||
#define CFDataRefObj_Check(x) (Py_Type(x) == &CFDataRef_Type || PyObject_TypeCheck((x), &CFDataRef_Type))
|
||||
#define CFDataRefObj_Check(x) (Py_TYPE(x) == &CFDataRef_Type || PyObject_TypeCheck((x), &CFDataRef_Type))
|
||||
|
||||
typedef struct CFDataRefObject {
|
||||
PyObject_HEAD
|
||||
|
@ -1524,7 +1524,7 @@ PyTypeObject CFDataRef_Type = {
|
|||
|
||||
PyTypeObject CFMutableDataRef_Type;
|
||||
|
||||
#define CFMutableDataRefObj_Check(x) (Py_Type(x) == &CFMutableDataRef_Type || PyObject_TypeCheck((x), &CFMutableDataRef_Type))
|
||||
#define CFMutableDataRefObj_Check(x) (Py_TYPE(x) == &CFMutableDataRef_Type || PyObject_TypeCheck((x), &CFMutableDataRef_Type))
|
||||
|
||||
typedef struct CFMutableDataRefObject {
|
||||
PyObject_HEAD
|
||||
|
@ -1788,7 +1788,7 @@ PyTypeObject CFMutableDataRef_Type = {
|
|||
|
||||
PyTypeObject CFStringRef_Type;
|
||||
|
||||
#define CFStringRefObj_Check(x) (Py_Type(x) == &CFStringRef_Type || PyObject_TypeCheck((x), &CFStringRef_Type))
|
||||
#define CFStringRefObj_Check(x) (Py_TYPE(x) == &CFStringRef_Type || PyObject_TypeCheck((x), &CFStringRef_Type))
|
||||
|
||||
typedef struct CFStringRefObject {
|
||||
PyObject_HEAD
|
||||
|
@ -2530,7 +2530,7 @@ PyTypeObject CFStringRef_Type = {
|
|||
|
||||
PyTypeObject CFMutableStringRef_Type;
|
||||
|
||||
#define CFMutableStringRefObj_Check(x) (Py_Type(x) == &CFMutableStringRef_Type || PyObject_TypeCheck((x), &CFMutableStringRef_Type))
|
||||
#define CFMutableStringRefObj_Check(x) (Py_TYPE(x) == &CFMutableStringRef_Type || PyObject_TypeCheck((x), &CFMutableStringRef_Type))
|
||||
|
||||
typedef struct CFMutableStringRefObject {
|
||||
PyObject_HEAD
|
||||
|
@ -2917,7 +2917,7 @@ PyTypeObject CFMutableStringRef_Type = {
|
|||
|
||||
PyTypeObject CFURLRef_Type;
|
||||
|
||||
#define CFURLRefObj_Check(x) (Py_Type(x) == &CFURLRef_Type || PyObject_TypeCheck((x), &CFURLRef_Type))
|
||||
#define CFURLRefObj_Check(x) (Py_TYPE(x) == &CFURLRef_Type || PyObject_TypeCheck((x), &CFURLRef_Type))
|
||||
|
||||
typedef struct CFURLRefObject {
|
||||
PyObject_HEAD
|
||||
|
@ -4890,14 +4890,14 @@ void init_CF(void)
|
|||
if (CF_Error == NULL ||
|
||||
PyDict_SetItemString(d, "Error", CF_Error) != 0)
|
||||
return;
|
||||
Py_Type(&CFTypeRef_Type) = &PyType_Type;
|
||||
Py_TYPE(&CFTypeRef_Type) = &PyType_Type;
|
||||
if (PyType_Ready(&CFTypeRef_Type) < 0) return;
|
||||
Py_INCREF(&CFTypeRef_Type);
|
||||
PyModule_AddObject(m, "CFTypeRef", (PyObject *)&CFTypeRef_Type);
|
||||
/* Backward-compatible name */
|
||||
Py_INCREF(&CFTypeRef_Type);
|
||||
PyModule_AddObject(m, "CFTypeRefType", (PyObject *)&CFTypeRef_Type);
|
||||
Py_Type(&CFArrayRef_Type) = &PyType_Type;
|
||||
Py_TYPE(&CFArrayRef_Type) = &PyType_Type;
|
||||
CFArrayRef_Type.tp_base = &CFTypeRef_Type;
|
||||
if (PyType_Ready(&CFArrayRef_Type) < 0) return;
|
||||
Py_INCREF(&CFArrayRef_Type);
|
||||
|
@ -4905,7 +4905,7 @@ void init_CF(void)
|
|||
/* Backward-compatible name */
|
||||
Py_INCREF(&CFArrayRef_Type);
|
||||
PyModule_AddObject(m, "CFArrayRefType", (PyObject *)&CFArrayRef_Type);
|
||||
Py_Type(&CFMutableArrayRef_Type) = &PyType_Type;
|
||||
Py_TYPE(&CFMutableArrayRef_Type) = &PyType_Type;
|
||||
CFMutableArrayRef_Type.tp_base = &CFArrayRef_Type;
|
||||
if (PyType_Ready(&CFMutableArrayRef_Type) < 0) return;
|
||||
Py_INCREF(&CFMutableArrayRef_Type);
|
||||
|
@ -4913,7 +4913,7 @@ void init_CF(void)
|
|||
/* Backward-compatible name */
|
||||
Py_INCREF(&CFMutableArrayRef_Type);
|
||||
PyModule_AddObject(m, "CFMutableArrayRefType", (PyObject *)&CFMutableArrayRef_Type);
|
||||
Py_Type(&CFDictionaryRef_Type) = &PyType_Type;
|
||||
Py_TYPE(&CFDictionaryRef_Type) = &PyType_Type;
|
||||
CFDictionaryRef_Type.tp_base = &CFTypeRef_Type;
|
||||
if (PyType_Ready(&CFDictionaryRef_Type) < 0) return;
|
||||
Py_INCREF(&CFDictionaryRef_Type);
|
||||
|
@ -4921,7 +4921,7 @@ void init_CF(void)
|
|||
/* Backward-compatible name */
|
||||
Py_INCREF(&CFDictionaryRef_Type);
|
||||
PyModule_AddObject(m, "CFDictionaryRefType", (PyObject *)&CFDictionaryRef_Type);
|
||||
Py_Type(&CFMutableDictionaryRef_Type) = &PyType_Type;
|
||||
Py_TYPE(&CFMutableDictionaryRef_Type) = &PyType_Type;
|
||||
CFMutableDictionaryRef_Type.tp_base = &CFDictionaryRef_Type;
|
||||
if (PyType_Ready(&CFMutableDictionaryRef_Type) < 0) return;
|
||||
Py_INCREF(&CFMutableDictionaryRef_Type);
|
||||
|
@ -4929,7 +4929,7 @@ void init_CF(void)
|
|||
/* Backward-compatible name */
|
||||
Py_INCREF(&CFMutableDictionaryRef_Type);
|
||||
PyModule_AddObject(m, "CFMutableDictionaryRefType", (PyObject *)&CFMutableDictionaryRef_Type);
|
||||
Py_Type(&CFDataRef_Type) = &PyType_Type;
|
||||
Py_TYPE(&CFDataRef_Type) = &PyType_Type;
|
||||
CFDataRef_Type.tp_base = &CFTypeRef_Type;
|
||||
if (PyType_Ready(&CFDataRef_Type) < 0) return;
|
||||
Py_INCREF(&CFDataRef_Type);
|
||||
|
@ -4937,7 +4937,7 @@ void init_CF(void)
|
|||
/* Backward-compatible name */
|
||||
Py_INCREF(&CFDataRef_Type);
|
||||
PyModule_AddObject(m, "CFDataRefType", (PyObject *)&CFDataRef_Type);
|
||||
Py_Type(&CFMutableDataRef_Type) = &PyType_Type;
|
||||
Py_TYPE(&CFMutableDataRef_Type) = &PyType_Type;
|
||||
CFMutableDataRef_Type.tp_base = &CFDataRef_Type;
|
||||
if (PyType_Ready(&CFMutableDataRef_Type) < 0) return;
|
||||
Py_INCREF(&CFMutableDataRef_Type);
|
||||
|
@ -4945,7 +4945,7 @@ void init_CF(void)
|
|||
/* Backward-compatible name */
|
||||
Py_INCREF(&CFMutableDataRef_Type);
|
||||
PyModule_AddObject(m, "CFMutableDataRefType", (PyObject *)&CFMutableDataRef_Type);
|
||||
Py_Type(&CFStringRef_Type) = &PyType_Type;
|
||||
Py_TYPE(&CFStringRef_Type) = &PyType_Type;
|
||||
CFStringRef_Type.tp_base = &CFTypeRef_Type;
|
||||
if (PyType_Ready(&CFStringRef_Type) < 0) return;
|
||||
Py_INCREF(&CFStringRef_Type);
|
||||
|
@ -4953,7 +4953,7 @@ void init_CF(void)
|
|||
/* Backward-compatible name */
|
||||
Py_INCREF(&CFStringRef_Type);
|
||||
PyModule_AddObject(m, "CFStringRefType", (PyObject *)&CFStringRef_Type);
|
||||
Py_Type(&CFMutableStringRef_Type) = &PyType_Type;
|
||||
Py_TYPE(&CFMutableStringRef_Type) = &PyType_Type;
|
||||
CFMutableStringRef_Type.tp_base = &CFStringRef_Type;
|
||||
if (PyType_Ready(&CFMutableStringRef_Type) < 0) return;
|
||||
Py_INCREF(&CFMutableStringRef_Type);
|
||||
|
@ -4961,7 +4961,7 @@ void init_CF(void)
|
|||
/* Backward-compatible name */
|
||||
Py_INCREF(&CFMutableStringRef_Type);
|
||||
PyModule_AddObject(m, "CFMutableStringRefType", (PyObject *)&CFMutableStringRef_Type);
|
||||
Py_Type(&CFURLRef_Type) = &PyType_Type;
|
||||
Py_TYPE(&CFURLRef_Type) = &PyType_Type;
|
||||
CFURLRef_Type.tp_base = &CFTypeRef_Type;
|
||||
if (PyType_Ready(&CFURLRef_Type) < 0) return;
|
||||
Py_INCREF(&CFURLRef_Type);
|
||||
|
|
|
@ -95,7 +95,7 @@ static PyObject *CG_Error;
|
|||
|
||||
PyTypeObject CGContextRef_Type;
|
||||
|
||||
#define CGContextRefObj_Check(x) (Py_Type(x) == &CGContextRef_Type || PyObject_TypeCheck((x), &CGContextRef_Type))
|
||||
#define CGContextRefObj_Check(x) (Py_TYPE(x) == &CGContextRef_Type || PyObject_TypeCheck((x), &CGContextRef_Type))
|
||||
|
||||
typedef struct CGContextRefObject {
|
||||
PyObject_HEAD
|
||||
|
@ -125,7 +125,7 @@ int CGContextRefObj_Convert(PyObject *v, CGContextRef *p_itself)
|
|||
static void CGContextRefObj_dealloc(CGContextRefObject *self)
|
||||
{
|
||||
CGContextRelease(self->ob_itself);
|
||||
Py_Type(self)->tp_free((PyObject *)self);
|
||||
Py_TYPE(self)->tp_free((PyObject *)self);
|
||||
}
|
||||
|
||||
static PyObject *CGContextRefObj_CGContextSaveGState(CGContextRefObject *_self, PyObject *_args)
|
||||
|
@ -1294,7 +1294,7 @@ void init_CG(void)
|
|||
if (CG_Error == NULL ||
|
||||
PyDict_SetItemString(d, "Error", CG_Error) != 0)
|
||||
return;
|
||||
Py_Type(&CGContextRef_Type) = &PyType_Type;
|
||||
Py_TYPE(&CGContextRef_Type) = &PyType_Type;
|
||||
if (PyType_Ready(&CGContextRef_Type) < 0) return;
|
||||
Py_INCREF(&CGContextRef_Type);
|
||||
PyModule_AddObject(m, "CGContextRef", (PyObject *)&CGContextRef_Type);
|
||||
|
|
|
@ -60,7 +60,7 @@ static PyObject *Cm_Error;
|
|||
|
||||
PyTypeObject ComponentInstance_Type;
|
||||
|
||||
#define CmpInstObj_Check(x) (Py_Type(x) == &ComponentInstance_Type || PyObject_TypeCheck((x), &ComponentInstance_Type))
|
||||
#define CmpInstObj_Check(x) (Py_TYPE(x) == &ComponentInstance_Type || PyObject_TypeCheck((x), &ComponentInstance_Type))
|
||||
|
||||
typedef struct ComponentInstanceObject {
|
||||
PyObject_HEAD
|
||||
|
@ -94,7 +94,7 @@ int CmpInstObj_Convert(PyObject *v, ComponentInstance *p_itself)
|
|||
static void CmpInstObj_dealloc(ComponentInstanceObject *self)
|
||||
{
|
||||
/* Cleanup of self->ob_itself goes here */
|
||||
Py_Type(self)->tp_free((PyObject *)self);
|
||||
Py_TYPE(self)->tp_free((PyObject *)self);
|
||||
}
|
||||
|
||||
static PyObject *CmpInstObj_CloseComponent(ComponentInstanceObject *_self, PyObject *_args)
|
||||
|
@ -326,7 +326,7 @@ PyTypeObject ComponentInstance_Type = {
|
|||
|
||||
PyTypeObject Component_Type;
|
||||
|
||||
#define CmpObj_Check(x) (Py_Type(x) == &Component_Type || PyObject_TypeCheck((x), &Component_Type))
|
||||
#define CmpObj_Check(x) (Py_TYPE(x) == &Component_Type || PyObject_TypeCheck((x), &Component_Type))
|
||||
|
||||
typedef struct ComponentObject {
|
||||
PyObject_HEAD
|
||||
|
@ -365,7 +365,7 @@ int CmpObj_Convert(PyObject *v, Component *p_itself)
|
|||
static void CmpObj_dealloc(ComponentObject *self)
|
||||
{
|
||||
/* Cleanup of self->ob_itself goes here */
|
||||
Py_Type(self)->tp_free((PyObject *)self);
|
||||
Py_TYPE(self)->tp_free((PyObject *)self);
|
||||
}
|
||||
|
||||
static PyObject *CmpObj_UnregisterComponent(ComponentObject *_self, PyObject *_args)
|
||||
|
@ -925,14 +925,14 @@ void init_Cm(void)
|
|||
if (Cm_Error == NULL ||
|
||||
PyDict_SetItemString(d, "Error", Cm_Error) != 0)
|
||||
return;
|
||||
Py_Type(&ComponentInstance_Type) = &PyType_Type;
|
||||
Py_TYPE(&ComponentInstance_Type) = &PyType_Type;
|
||||
if (PyType_Ready(&ComponentInstance_Type) < 0) return;
|
||||
Py_INCREF(&ComponentInstance_Type);
|
||||
PyModule_AddObject(m, "ComponentInstance", (PyObject *)&ComponentInstance_Type);
|
||||
/* Backward-compatible name */
|
||||
Py_INCREF(&ComponentInstance_Type);
|
||||
PyModule_AddObject(m, "ComponentInstanceType", (PyObject *)&ComponentInstance_Type);
|
||||
Py_Type(&Component_Type) = &PyType_Type;
|
||||
Py_TYPE(&Component_Type) = &PyType_Type;
|
||||
if (PyType_Ready(&Component_Type) < 0) return;
|
||||
Py_INCREF(&Component_Type);
|
||||
PyModule_AddObject(m, "Component", (PyObject *)&Component_Type);
|
||||
|
|
|
@ -135,7 +135,7 @@ static PyObject *Ctl_Error;
|
|||
|
||||
PyTypeObject Control_Type;
|
||||
|
||||
#define CtlObj_Check(x) (Py_Type(x) == &Control_Type || PyObject_TypeCheck((x), &Control_Type))
|
||||
#define CtlObj_Check(x) (Py_TYPE(x) == &Control_Type || PyObject_TypeCheck((x), &Control_Type))
|
||||
|
||||
typedef struct ControlObject {
|
||||
PyObject_HEAD
|
||||
|
@ -170,7 +170,7 @@ static void CtlObj_dealloc(ControlObject *self)
|
|||
{
|
||||
Py_XDECREF(self->ob_callbackdict);
|
||||
if (self->ob_itself)SetControlReference(self->ob_itself, (long)0); /* Make it forget about us */
|
||||
Py_Type(self)->tp_free((PyObject *)self);
|
||||
Py_TYPE(self)->tp_free((PyObject *)self);
|
||||
}
|
||||
|
||||
static PyObject *CtlObj_HiliteControl(ControlObject *_self, PyObject *_args)
|
||||
|
@ -5790,7 +5790,7 @@ void init_Ctl(void)
|
|||
if (Ctl_Error == NULL ||
|
||||
PyDict_SetItemString(d, "Error", Ctl_Error) != 0)
|
||||
return;
|
||||
Py_Type(&Control_Type) = &PyType_Type;
|
||||
Py_TYPE(&Control_Type) = &PyType_Type;
|
||||
if (PyType_Ready(&Control_Type) < 0) return;
|
||||
Py_INCREF(&Control_Type);
|
||||
PyModule_AddObject(m, "Control", (PyObject *)&Control_Type);
|
||||
|
|
|
@ -129,7 +129,7 @@ static PyObject *Dlg_Error;
|
|||
|
||||
PyTypeObject Dialog_Type;
|
||||
|
||||
#define DlgObj_Check(x) (Py_Type(x) == &Dialog_Type || PyObject_TypeCheck((x), &Dialog_Type))
|
||||
#define DlgObj_Check(x) (Py_TYPE(x) == &Dialog_Type || PyObject_TypeCheck((x), &Dialog_Type))
|
||||
|
||||
typedef struct DialogObject {
|
||||
PyObject_HEAD
|
||||
|
@ -164,7 +164,7 @@ int DlgObj_Convert(PyObject *v, DialogPtr *p_itself)
|
|||
static void DlgObj_dealloc(DialogObject *self)
|
||||
{
|
||||
DisposeDialog(self->ob_itself);
|
||||
Py_Type(self)->tp_free((PyObject *)self);
|
||||
Py_TYPE(self)->tp_free((PyObject *)self);
|
||||
}
|
||||
|
||||
static PyObject *DlgObj_DrawDialog(DialogObject *_self, PyObject *_args)
|
||||
|
@ -1582,7 +1582,7 @@ void init_Dlg(void)
|
|||
if (Dlg_Error == NULL ||
|
||||
PyDict_SetItemString(d, "Error", Dlg_Error) != 0)
|
||||
return;
|
||||
Py_Type(&Dialog_Type) = &PyType_Type;
|
||||
Py_TYPE(&Dialog_Type) = &PyType_Type;
|
||||
if (PyType_Ready(&Dialog_Type) < 0) return;
|
||||
Py_INCREF(&Dialog_Type);
|
||||
PyModule_AddObject(m, "Dialog", (PyObject *)&Dialog_Type);
|
||||
|
|
|
@ -40,7 +40,7 @@ static PyObject *Drag_Error;
|
|||
|
||||
PyTypeObject DragObj_Type;
|
||||
|
||||
#define DragObj_Check(x) (Py_Type(x) == &DragObj_Type || PyObject_TypeCheck((x), &DragObj_Type))
|
||||
#define DragObj_Check(x) (Py_TYPE(x) == &DragObj_Type || PyObject_TypeCheck((x), &DragObj_Type))
|
||||
|
||||
typedef struct DragObjObject {
|
||||
PyObject_HEAD
|
||||
|
@ -76,7 +76,7 @@ int DragObj_Convert(PyObject *v, DragRef *p_itself)
|
|||
static void DragObj_dealloc(DragObjObject *self)
|
||||
{
|
||||
Py_XDECREF(self->sendproc);
|
||||
Py_Type(self)->tp_free((PyObject *)self);
|
||||
Py_TYPE(self)->tp_free((PyObject *)self);
|
||||
}
|
||||
|
||||
static PyObject *DragObj_DisposeDrag(DragObjObject *_self, PyObject *_args)
|
||||
|
@ -1125,7 +1125,7 @@ void init_Drag(void)
|
|||
if (Drag_Error == NULL ||
|
||||
PyDict_SetItemString(d, "Error", Drag_Error) != 0)
|
||||
return;
|
||||
Py_Type(&DragObj_Type) = &PyType_Type;
|
||||
Py_TYPE(&DragObj_Type) = &PyType_Type;
|
||||
if (PyType_Ready(&DragObj_Type) < 0) return;
|
||||
Py_INCREF(&DragObj_Type);
|
||||
PyModule_AddObject(m, "DragObj", (PyObject *)&DragObj_Type);
|
||||
|
|
|
@ -143,7 +143,7 @@ static PyObject *File_Error;
|
|||
|
||||
static PyTypeObject FSCatalogInfo_Type;
|
||||
|
||||
#define FSCatalogInfo_Check(x) (Py_Type(x) == &FSCatalogInfo_Type || PyObject_TypeCheck((x), &FSCatalogInfo_Type))
|
||||
#define FSCatalogInfo_Check(x) (Py_TYPE(x) == &FSCatalogInfo_Type || PyObject_TypeCheck((x), &FSCatalogInfo_Type))
|
||||
|
||||
typedef struct FSCatalogInfoObject {
|
||||
PyObject_HEAD
|
||||
|
@ -174,7 +174,7 @@ static int FSCatalogInfo_Convert(PyObject *v, FSCatalogInfo *p_itself)
|
|||
static void FSCatalogInfo_dealloc(FSCatalogInfoObject *self)
|
||||
{
|
||||
/* Cleanup of self->ob_itself goes here */
|
||||
Py_Type(self)->tp_free((PyObject *)self);
|
||||
Py_TYPE(self)->tp_free((PyObject *)self);
|
||||
}
|
||||
|
||||
static PyMethodDef FSCatalogInfo_methods[] = {
|
||||
|
@ -502,7 +502,7 @@ static PyTypeObject FSCatalogInfo_Type = {
|
|||
|
||||
static PyTypeObject FInfo_Type;
|
||||
|
||||
#define FInfo_Check(x) (Py_Type(x) == &FInfo_Type || PyObject_TypeCheck((x), &FInfo_Type))
|
||||
#define FInfo_Check(x) (Py_TYPE(x) == &FInfo_Type || PyObject_TypeCheck((x), &FInfo_Type))
|
||||
|
||||
typedef struct FInfoObject {
|
||||
PyObject_HEAD
|
||||
|
@ -533,7 +533,7 @@ static int FInfo_Convert(PyObject *v, FInfo *p_itself)
|
|||
static void FInfo_dealloc(FInfoObject *self)
|
||||
{
|
||||
/* Cleanup of self->ob_itself goes here */
|
||||
Py_Type(self)->tp_free((PyObject *)self);
|
||||
Py_TYPE(self)->tp_free((PyObject *)self);
|
||||
}
|
||||
|
||||
static PyMethodDef FInfo_methods[] = {
|
||||
|
@ -687,7 +687,7 @@ static PyTypeObject FInfo_Type = {
|
|||
|
||||
static PyTypeObject Alias_Type;
|
||||
|
||||
#define Alias_Check(x) (Py_Type(x) == &Alias_Type || PyObject_TypeCheck((x), &Alias_Type))
|
||||
#define Alias_Check(x) (Py_TYPE(x) == &Alias_Type || PyObject_TypeCheck((x), &Alias_Type))
|
||||
|
||||
typedef struct AliasObject {
|
||||
PyObject_HEAD
|
||||
|
@ -724,7 +724,7 @@ static void Alias_dealloc(AliasObject *self)
|
|||
self->ob_freeit(self->ob_itself);
|
||||
}
|
||||
self->ob_itself = NULL;
|
||||
Py_Type(self)->tp_free((PyObject *)self);
|
||||
Py_TYPE(self)->tp_free((PyObject *)self);
|
||||
}
|
||||
|
||||
static PyObject *Alias_ResolveAlias(AliasObject *_self, PyObject *_args)
|
||||
|
@ -1053,7 +1053,7 @@ static PyObject *FSSpec_New(FSSpec *itself)
|
|||
static void FSSpec_dealloc(FSSpecObject *self)
|
||||
{
|
||||
/* Cleanup of self->ob_itself goes here */
|
||||
Py_Type(self)->tp_free((PyObject *)self);
|
||||
Py_TYPE(self)->tp_free((PyObject *)self);
|
||||
}
|
||||
|
||||
static PyObject *FSSpec_FSpOpenDF(FSSpecObject *_self, PyObject *_args)
|
||||
|
@ -1386,7 +1386,7 @@ static PyObject * FSSpec_repr(FSSpecObject *self)
|
|||
{
|
||||
char buf[512];
|
||||
PyOS_snprintf(buf, sizeof(buf), "%s((%d, %ld, '%.*s'))",
|
||||
Py_Type(self)->tp_name,
|
||||
Py_TYPE(self)->tp_name,
|
||||
self->ob_itself.vRefNum,
|
||||
self->ob_itself.parID,
|
||||
self->ob_itself.name[0], self->ob_itself.name+1);
|
||||
|
@ -1511,7 +1511,7 @@ static PyObject *FSRef_New(FSRef *itself)
|
|||
static void FSRef_dealloc(FSRefObject *self)
|
||||
{
|
||||
/* Cleanup of self->ob_itself goes here */
|
||||
Py_Type(self)->tp_free((PyObject *)self);
|
||||
Py_TYPE(self)->tp_free((PyObject *)self);
|
||||
}
|
||||
|
||||
static PyObject *FSRef_FSMakeFSRefUnicode(FSRefObject *_self, PyObject *_args)
|
||||
|
@ -3246,35 +3246,35 @@ void init_File(void)
|
|||
if (File_Error == NULL ||
|
||||
PyDict_SetItemString(d, "Error", File_Error) != 0)
|
||||
return;
|
||||
Py_Type(&FSCatalogInfo_Type) = &PyType_Type;
|
||||
Py_TYPE(&FSCatalogInfo_Type) = &PyType_Type;
|
||||
if (PyType_Ready(&FSCatalogInfo_Type) < 0) return;
|
||||
Py_INCREF(&FSCatalogInfo_Type);
|
||||
PyModule_AddObject(m, "FSCatalogInfo", (PyObject *)&FSCatalogInfo_Type);
|
||||
/* Backward-compatible name */
|
||||
Py_INCREF(&FSCatalogInfo_Type);
|
||||
PyModule_AddObject(m, "FSCatalogInfoType", (PyObject *)&FSCatalogInfo_Type);
|
||||
Py_Type(&FInfo_Type) = &PyType_Type;
|
||||
Py_TYPE(&FInfo_Type) = &PyType_Type;
|
||||
if (PyType_Ready(&FInfo_Type) < 0) return;
|
||||
Py_INCREF(&FInfo_Type);
|
||||
PyModule_AddObject(m, "FInfo", (PyObject *)&FInfo_Type);
|
||||
/* Backward-compatible name */
|
||||
Py_INCREF(&FInfo_Type);
|
||||
PyModule_AddObject(m, "FInfoType", (PyObject *)&FInfo_Type);
|
||||
Py_Type(&Alias_Type) = &PyType_Type;
|
||||
Py_TYPE(&Alias_Type) = &PyType_Type;
|
||||
if (PyType_Ready(&Alias_Type) < 0) return;
|
||||
Py_INCREF(&Alias_Type);
|
||||
PyModule_AddObject(m, "Alias", (PyObject *)&Alias_Type);
|
||||
/* Backward-compatible name */
|
||||
Py_INCREF(&Alias_Type);
|
||||
PyModule_AddObject(m, "AliasType", (PyObject *)&Alias_Type);
|
||||
Py_Type(&FSSpec_Type) = &PyType_Type;
|
||||
Py_TYPE(&FSSpec_Type) = &PyType_Type;
|
||||
if (PyType_Ready(&FSSpec_Type) < 0) return;
|
||||
Py_INCREF(&FSSpec_Type);
|
||||
PyModule_AddObject(m, "FSSpec", (PyObject *)&FSSpec_Type);
|
||||
/* Backward-compatible name */
|
||||
Py_INCREF(&FSSpec_Type);
|
||||
PyModule_AddObject(m, "FSSpecType", (PyObject *)&FSSpec_Type);
|
||||
Py_Type(&FSRef_Type) = &PyType_Type;
|
||||
Py_TYPE(&FSRef_Type) = &PyType_Type;
|
||||
if (PyType_Ready(&FSRef_Type) < 0) return;
|
||||
Py_INCREF(&FSRef_Type);
|
||||
PyModule_AddObject(m, "FSRef", (PyObject *)&FSRef_Type);
|
||||
|
|
|
@ -19,7 +19,7 @@ static PyObject *IBCarbon_Error;
|
|||
|
||||
PyTypeObject IBNibRef_Type;
|
||||
|
||||
#define IBNibRefObj_Check(x) (Py_Type(x) == &IBNibRef_Type || PyObject_TypeCheck((x), &IBNibRef_Type))
|
||||
#define IBNibRefObj_Check(x) (Py_TYPE(x) == &IBNibRef_Type || PyObject_TypeCheck((x), &IBNibRef_Type))
|
||||
|
||||
typedef struct IBNibRefObject {
|
||||
PyObject_HEAD
|
||||
|
@ -49,7 +49,7 @@ int IBNibRefObj_Convert(PyObject *v, IBNibRef *p_itself)
|
|||
static void IBNibRefObj_dealloc(IBNibRefObject *self)
|
||||
{
|
||||
DisposeNibReference(self->ob_itself);
|
||||
Py_Type(self)->tp_free((PyObject *)self);
|
||||
Py_TYPE(self)->tp_free((PyObject *)self);
|
||||
}
|
||||
|
||||
static PyObject *IBNibRefObj_CreateWindowFromNib(IBNibRefObject *_self, PyObject *_args)
|
||||
|
@ -248,7 +248,7 @@ void init_IBCarbon(void)
|
|||
if (IBCarbon_Error == NULL ||
|
||||
PyDict_SetItemString(d, "Error", IBCarbon_Error) != 0)
|
||||
return;
|
||||
Py_Type(&IBNibRef_Type) = &PyType_Type;
|
||||
Py_TYPE(&IBNibRef_Type) = &PyType_Type;
|
||||
if (PyType_Ready(&IBNibRef_Type) < 0) return;
|
||||
Py_INCREF(&IBNibRef_Type);
|
||||
PyModule_AddObject(m, "IBNibRef", (PyObject *)&IBNibRef_Type);
|
||||
|
|
|
@ -37,7 +37,7 @@ static PyObject *List_Error;
|
|||
|
||||
PyTypeObject List_Type;
|
||||
|
||||
#define ListObj_Check(x) (Py_Type(x) == &List_Type || PyObject_TypeCheck((x), &List_Type))
|
||||
#define ListObj_Check(x) (Py_TYPE(x) == &List_Type || PyObject_TypeCheck((x), &List_Type))
|
||||
|
||||
typedef struct ListObject {
|
||||
PyObject_HEAD
|
||||
|
@ -79,7 +79,7 @@ static void ListObj_dealloc(ListObject *self)
|
|||
self->ob_ldef_func = NULL;
|
||||
SetListRefCon(self->ob_itself, (long)0);
|
||||
if (self->ob_must_be_disposed && self->ob_itself) LDispose(self->ob_itself);
|
||||
Py_Type(self)->tp_free((PyObject *)self);
|
||||
Py_TYPE(self)->tp_free((PyObject *)self);
|
||||
}
|
||||
|
||||
static PyObject *ListObj_LAddColumn(ListObject *_self, PyObject *_args)
|
||||
|
@ -1116,7 +1116,7 @@ void init_List(void)
|
|||
if (List_Error == NULL ||
|
||||
PyDict_SetItemString(d, "Error", List_Error) != 0)
|
||||
return;
|
||||
Py_Type(&List_Type) = &PyType_Type;
|
||||
Py_TYPE(&List_Type) = &PyType_Type;
|
||||
if (PyType_Ready(&List_Type) < 0) return;
|
||||
Py_INCREF(&List_Type);
|
||||
PyModule_AddObject(m, "List", (PyObject *)&List_Type);
|
||||
|
|
|
@ -57,7 +57,7 @@ static PyObject *Menu_Error;
|
|||
|
||||
PyTypeObject Menu_Type;
|
||||
|
||||
#define MenuObj_Check(x) (Py_Type(x) == &Menu_Type || PyObject_TypeCheck((x), &Menu_Type))
|
||||
#define MenuObj_Check(x) (Py_TYPE(x) == &Menu_Type || PyObject_TypeCheck((x), &Menu_Type))
|
||||
|
||||
typedef struct MenuObject {
|
||||
PyObject_HEAD
|
||||
|
@ -87,7 +87,7 @@ int MenuObj_Convert(PyObject *v, MenuHandle *p_itself)
|
|||
static void MenuObj_dealloc(MenuObject *self)
|
||||
{
|
||||
/* Cleanup of self->ob_itself goes here */
|
||||
Py_Type(self)->tp_free((PyObject *)self);
|
||||
Py_TYPE(self)->tp_free((PyObject *)self);
|
||||
}
|
||||
|
||||
static PyObject *MenuObj_DisposeMenu(MenuObject *_self, PyObject *_args)
|
||||
|
@ -3455,7 +3455,7 @@ void init_Menu(void)
|
|||
if (Menu_Error == NULL ||
|
||||
PyDict_SetItemString(d, "Error", Menu_Error) != 0)
|
||||
return;
|
||||
Py_Type(&Menu_Type) = &PyType_Type;
|
||||
Py_TYPE(&Menu_Type) = &PyType_Type;
|
||||
if (PyType_Ready(&Menu_Type) < 0) return;
|
||||
Py_INCREF(&Menu_Type);
|
||||
PyModule_AddObject(m, "Menu", (PyObject *)&Menu_Type);
|
||||
|
|
|
@ -69,7 +69,7 @@ static PyObject *Mlte_Error;
|
|||
|
||||
PyTypeObject TXNObject_Type;
|
||||
|
||||
#define TXNObj_Check(x) (Py_Type(x) == &TXNObject_Type || PyObject_TypeCheck((x), &TXNObject_Type))
|
||||
#define TXNObj_Check(x) (Py_TYPE(x) == &TXNObject_Type || PyObject_TypeCheck((x), &TXNObject_Type))
|
||||
|
||||
typedef struct TXNObjectObject {
|
||||
PyObject_HEAD
|
||||
|
@ -100,7 +100,7 @@ int TXNObj_Convert(PyObject *v, TXNObject *p_itself)
|
|||
static void TXNObj_dealloc(TXNObjectObject *self)
|
||||
{
|
||||
/* Cleanup of self->ob_itself goes here */
|
||||
Py_Type(self)->tp_free((PyObject *)self);
|
||||
Py_TYPE(self)->tp_free((PyObject *)self);
|
||||
}
|
||||
|
||||
static PyObject *TXNObj_TXNDeleteObject(TXNObjectObject *_self, PyObject *_args)
|
||||
|
@ -1304,7 +1304,7 @@ PyTypeObject TXNObject_Type = {
|
|||
|
||||
PyTypeObject TXNFontMenuObject_Type;
|
||||
|
||||
#define TXNFontMenuObj_Check(x) (Py_Type(x) == &TXNFontMenuObject_Type || PyObject_TypeCheck((x), &TXNFontMenuObject_Type))
|
||||
#define TXNFontMenuObj_Check(x) (Py_TYPE(x) == &TXNFontMenuObject_Type || PyObject_TypeCheck((x), &TXNFontMenuObject_Type))
|
||||
|
||||
typedef struct TXNFontMenuObjectObject {
|
||||
PyObject_HEAD
|
||||
|
@ -1335,7 +1335,7 @@ int TXNFontMenuObj_Convert(PyObject *v, TXNFontMenuObject *p_itself)
|
|||
static void TXNFontMenuObj_dealloc(TXNFontMenuObjectObject *self)
|
||||
{
|
||||
/* Cleanup of self->ob_itself goes here */
|
||||
Py_Type(self)->tp_free((PyObject *)self);
|
||||
Py_TYPE(self)->tp_free((PyObject *)self);
|
||||
}
|
||||
|
||||
static PyObject *TXNFontMenuObj_TXNGetFontMenuHandle(TXNFontMenuObjectObject *_self, PyObject *_args)
|
||||
|
@ -1659,14 +1659,14 @@ void init_Mlte(void)
|
|||
if (Mlte_Error == NULL ||
|
||||
PyDict_SetItemString(d, "Error", Mlte_Error) != 0)
|
||||
return;
|
||||
Py_Type(&TXNObject_Type) = &PyType_Type;
|
||||
Py_TYPE(&TXNObject_Type) = &PyType_Type;
|
||||
if (PyType_Ready(&TXNObject_Type) < 0) return;
|
||||
Py_INCREF(&TXNObject_Type);
|
||||
PyModule_AddObject(m, "TXNObject", (PyObject *)&TXNObject_Type);
|
||||
/* Backward-compatible name */
|
||||
Py_INCREF(&TXNObject_Type);
|
||||
PyModule_AddObject(m, "TXNObjectType", (PyObject *)&TXNObject_Type);
|
||||
Py_Type(&TXNFontMenuObject_Type) = &PyType_Type;
|
||||
Py_TYPE(&TXNFontMenuObject_Type) = &PyType_Type;
|
||||
if (PyType_Ready(&TXNFontMenuObject_Type) < 0) return;
|
||||
Py_INCREF(&TXNFontMenuObject_Type);
|
||||
PyModule_AddObject(m, "TXNFontMenuObject", (PyObject *)&TXNFontMenuObject_Type);
|
||||
|
|
|
@ -34,7 +34,7 @@ static PyObject *OSA_Error;
|
|||
|
||||
PyTypeObject OSAComponentInstance_Type;
|
||||
|
||||
#define OSAObj_Check(x) (Py_Type(x) == &OSAComponentInstance_Type || PyObject_TypeCheck((x), &OSAComponentInstance_Type))
|
||||
#define OSAObj_Check(x) (Py_TYPE(x) == &OSAComponentInstance_Type || PyObject_TypeCheck((x), &OSAComponentInstance_Type))
|
||||
|
||||
typedef struct OSAComponentInstanceObject {
|
||||
PyObject_HEAD
|
||||
|
@ -73,7 +73,7 @@ int OSAObj_Convert(PyObject *v, ComponentInstance *p_itself)
|
|||
static void OSAObj_dealloc(OSAComponentInstanceObject *self)
|
||||
{
|
||||
/* Cleanup of self->ob_itself goes here */
|
||||
Py_Type(self)->tp_free((PyObject *)self);
|
||||
Py_TYPE(self)->tp_free((PyObject *)self);
|
||||
}
|
||||
|
||||
static PyObject *OSAObj_OSALoad(OSAComponentInstanceObject *_self, PyObject *_args)
|
||||
|
@ -885,7 +885,7 @@ void init_OSA(void)
|
|||
if (OSA_Error == NULL ||
|
||||
PyDict_SetItemString(d, "Error", OSA_Error) != 0)
|
||||
return;
|
||||
Py_Type(&OSAComponentInstance_Type) = &PyType_Type;
|
||||
Py_TYPE(&OSAComponentInstance_Type) = &PyType_Type;
|
||||
if (PyType_Ready(&OSAComponentInstance_Type) < 0) return;
|
||||
Py_INCREF(&OSAComponentInstance_Type);
|
||||
PyModule_AddObject(m, "OSAComponentInstance", (PyObject *)&OSAComponentInstance_Type);
|
||||
|
|
|
@ -73,7 +73,7 @@ static PyObject *Qd_Error;
|
|||
|
||||
PyTypeObject GrafPort_Type;
|
||||
|
||||
#define GrafObj_Check(x) (Py_Type(x) == &GrafPort_Type || PyObject_TypeCheck((x), &GrafPort_Type))
|
||||
#define GrafObj_Check(x) (Py_TYPE(x) == &GrafPort_Type || PyObject_TypeCheck((x), &GrafPort_Type))
|
||||
|
||||
typedef struct GrafPortObject {
|
||||
PyObject_HEAD
|
||||
|
@ -125,7 +125,7 @@ int GrafObj_Convert(PyObject *v, GrafPtr *p_itself)
|
|||
static void GrafObj_dealloc(GrafPortObject *self)
|
||||
{
|
||||
/* Cleanup of self->ob_itself goes here */
|
||||
Py_Type(self)->tp_free((PyObject *)self);
|
||||
Py_TYPE(self)->tp_free((PyObject *)self);
|
||||
}
|
||||
|
||||
static PyObject *GrafObj_MacSetPort(GrafPortObject *_self, PyObject *_args)
|
||||
|
@ -1407,7 +1407,7 @@ PyTypeObject GrafPort_Type = {
|
|||
|
||||
PyTypeObject BitMap_Type;
|
||||
|
||||
#define BMObj_Check(x) (Py_Type(x) == &BitMap_Type || PyObject_TypeCheck((x), &BitMap_Type))
|
||||
#define BMObj_Check(x) (Py_TYPE(x) == &BitMap_Type || PyObject_TypeCheck((x), &BitMap_Type))
|
||||
|
||||
typedef struct BitMapObject {
|
||||
PyObject_HEAD
|
||||
|
@ -1443,7 +1443,7 @@ static void BMObj_dealloc(BitMapObject *self)
|
|||
{
|
||||
Py_XDECREF(self->referred_object);
|
||||
if (self->referred_bitmap) free(self->referred_bitmap);
|
||||
Py_Type(self)->tp_free((PyObject *)self);
|
||||
Py_TYPE(self)->tp_free((PyObject *)self);
|
||||
}
|
||||
|
||||
static PyObject *BMObj_getdata(BitMapObject *_self, PyObject *_args)
|
||||
|
@ -7122,14 +7122,14 @@ void init_Qd(void)
|
|||
if (Qd_Error == NULL ||
|
||||
PyDict_SetItemString(d, "Error", Qd_Error) != 0)
|
||||
return;
|
||||
Py_Type(&GrafPort_Type) = &PyType_Type;
|
||||
Py_TYPE(&GrafPort_Type) = &PyType_Type;
|
||||
if (PyType_Ready(&GrafPort_Type) < 0) return;
|
||||
Py_INCREF(&GrafPort_Type);
|
||||
PyModule_AddObject(m, "GrafPort", (PyObject *)&GrafPort_Type);
|
||||
/* Backward-compatible name */
|
||||
Py_INCREF(&GrafPort_Type);
|
||||
PyModule_AddObject(m, "GrafPortType", (PyObject *)&GrafPort_Type);
|
||||
Py_Type(&BitMap_Type) = &PyType_Type;
|
||||
Py_TYPE(&BitMap_Type) = &PyType_Type;
|
||||
if (PyType_Ready(&BitMap_Type) < 0) return;
|
||||
Py_INCREF(&BitMap_Type);
|
||||
PyModule_AddObject(m, "BitMap", (PyObject *)&BitMap_Type);
|
||||
|
|
|
@ -34,7 +34,7 @@ static PyObject *Qdoffs_Error;
|
|||
|
||||
PyTypeObject GWorld_Type;
|
||||
|
||||
#define GWorldObj_Check(x) (Py_Type(x) == &GWorld_Type || PyObject_TypeCheck((x), &GWorld_Type))
|
||||
#define GWorldObj_Check(x) (Py_TYPE(x) == &GWorld_Type || PyObject_TypeCheck((x), &GWorld_Type))
|
||||
|
||||
typedef struct GWorldObject {
|
||||
PyObject_HEAD
|
||||
|
@ -65,7 +65,7 @@ int GWorldObj_Convert(PyObject *v, GWorldPtr *p_itself)
|
|||
static void GWorldObj_dealloc(GWorldObject *self)
|
||||
{
|
||||
DisposeGWorld(self->ob_itself);
|
||||
Py_Type(self)->tp_free((PyObject *)self);
|
||||
Py_TYPE(self)->tp_free((PyObject *)self);
|
||||
}
|
||||
|
||||
static PyObject *GWorldObj_GetGWorldDevice(GWorldObject *_self, PyObject *_args)
|
||||
|
@ -700,7 +700,7 @@ void init_Qdoffs(void)
|
|||
if (Qdoffs_Error == NULL ||
|
||||
PyDict_SetItemString(d, "Error", Qdoffs_Error) != 0)
|
||||
return;
|
||||
Py_Type(&GWorld_Type) = &PyType_Type;
|
||||
Py_TYPE(&GWorld_Type) = &PyType_Type;
|
||||
if (PyType_Ready(&GWorld_Type) < 0) return;
|
||||
Py_INCREF(&GWorld_Type);
|
||||
PyModule_AddObject(m, "GWorld", (PyObject *)&GWorld_Type);
|
||||
|
|
|
@ -97,7 +97,7 @@ static PyObject *Qt_Error;
|
|||
|
||||
PyTypeObject IdleManager_Type;
|
||||
|
||||
#define IdleManagerObj_Check(x) (Py_Type(x) == &IdleManager_Type || PyObject_TypeCheck((x), &IdleManager_Type))
|
||||
#define IdleManagerObj_Check(x) (Py_TYPE(x) == &IdleManager_Type || PyObject_TypeCheck((x), &IdleManager_Type))
|
||||
|
||||
typedef struct IdleManagerObject {
|
||||
PyObject_HEAD
|
||||
|
@ -136,7 +136,7 @@ int IdleManagerObj_Convert(PyObject *v, IdleManager *p_itself)
|
|||
static void IdleManagerObj_dealloc(IdleManagerObject *self)
|
||||
{
|
||||
/* Cleanup of self->ob_itself goes here */
|
||||
Py_Type(self)->tp_free((PyObject *)self);
|
||||
Py_TYPE(self)->tp_free((PyObject *)self);
|
||||
}
|
||||
|
||||
static PyMethodDef IdleManagerObj_methods[] = {
|
||||
|
@ -220,7 +220,7 @@ PyTypeObject IdleManager_Type = {
|
|||
|
||||
PyTypeObject MovieController_Type;
|
||||
|
||||
#define MovieCtlObj_Check(x) (Py_Type(x) == &MovieController_Type || PyObject_TypeCheck((x), &MovieController_Type))
|
||||
#define MovieCtlObj_Check(x) (Py_TYPE(x) == &MovieController_Type || PyObject_TypeCheck((x), &MovieController_Type))
|
||||
|
||||
typedef struct MovieControllerObject {
|
||||
PyObject_HEAD
|
||||
|
@ -259,7 +259,7 @@ int MovieCtlObj_Convert(PyObject *v, MovieController *p_itself)
|
|||
static void MovieCtlObj_dealloc(MovieControllerObject *self)
|
||||
{
|
||||
if (self->ob_itself) DisposeMovieController(self->ob_itself);
|
||||
Py_Type(self)->tp_free((PyObject *)self);
|
||||
Py_TYPE(self)->tp_free((PyObject *)self);
|
||||
}
|
||||
|
||||
static PyObject *MovieCtlObj_MCSetMovie(MovieControllerObject *_self, PyObject *_args)
|
||||
|
@ -1339,7 +1339,7 @@ PyTypeObject MovieController_Type = {
|
|||
|
||||
PyTypeObject TimeBase_Type;
|
||||
|
||||
#define TimeBaseObj_Check(x) (Py_Type(x) == &TimeBase_Type || PyObject_TypeCheck((x), &TimeBase_Type))
|
||||
#define TimeBaseObj_Check(x) (Py_TYPE(x) == &TimeBase_Type || PyObject_TypeCheck((x), &TimeBase_Type))
|
||||
|
||||
typedef struct TimeBaseObject {
|
||||
PyObject_HEAD
|
||||
|
@ -1378,7 +1378,7 @@ int TimeBaseObj_Convert(PyObject *v, TimeBase *p_itself)
|
|||
static void TimeBaseObj_dealloc(TimeBaseObject *self)
|
||||
{
|
||||
/* Cleanup of self->ob_itself goes here */
|
||||
Py_Type(self)->tp_free((PyObject *)self);
|
||||
Py_TYPE(self)->tp_free((PyObject *)self);
|
||||
}
|
||||
|
||||
static PyObject *TimeBaseObj_DisposeTimeBase(TimeBaseObject *_self, PyObject *_args)
|
||||
|
@ -1832,7 +1832,7 @@ PyTypeObject TimeBase_Type = {
|
|||
|
||||
PyTypeObject UserData_Type;
|
||||
|
||||
#define UserDataObj_Check(x) (Py_Type(x) == &UserData_Type || PyObject_TypeCheck((x), &UserData_Type))
|
||||
#define UserDataObj_Check(x) (Py_TYPE(x) == &UserData_Type || PyObject_TypeCheck((x), &UserData_Type))
|
||||
|
||||
typedef struct UserDataObject {
|
||||
PyObject_HEAD
|
||||
|
@ -1871,7 +1871,7 @@ int UserDataObj_Convert(PyObject *v, UserData *p_itself)
|
|||
static void UserDataObj_dealloc(UserDataObject *self)
|
||||
{
|
||||
if (self->ob_itself) DisposeUserData(self->ob_itself);
|
||||
Py_Type(self)->tp_free((PyObject *)self);
|
||||
Py_TYPE(self)->tp_free((PyObject *)self);
|
||||
}
|
||||
|
||||
static PyObject *UserDataObj_GetUserData(UserDataObject *_self, PyObject *_args)
|
||||
|
@ -2202,7 +2202,7 @@ PyTypeObject UserData_Type = {
|
|||
|
||||
PyTypeObject Media_Type;
|
||||
|
||||
#define MediaObj_Check(x) (Py_Type(x) == &Media_Type || PyObject_TypeCheck((x), &Media_Type))
|
||||
#define MediaObj_Check(x) (Py_TYPE(x) == &Media_Type || PyObject_TypeCheck((x), &Media_Type))
|
||||
|
||||
typedef struct MediaObject {
|
||||
PyObject_HEAD
|
||||
|
@ -2241,7 +2241,7 @@ int MediaObj_Convert(PyObject *v, Media *p_itself)
|
|||
static void MediaObj_dealloc(MediaObject *self)
|
||||
{
|
||||
if (self->ob_itself) DisposeTrackMedia(self->ob_itself);
|
||||
Py_Type(self)->tp_free((PyObject *)self);
|
||||
Py_TYPE(self)->tp_free((PyObject *)self);
|
||||
}
|
||||
|
||||
static PyObject *MediaObj_LoadMediaIntoRam(MediaObject *_self, PyObject *_args)
|
||||
|
@ -3443,7 +3443,7 @@ PyTypeObject Media_Type = {
|
|||
|
||||
PyTypeObject Track_Type;
|
||||
|
||||
#define TrackObj_Check(x) (Py_Type(x) == &Track_Type || PyObject_TypeCheck((x), &Track_Type))
|
||||
#define TrackObj_Check(x) (Py_TYPE(x) == &Track_Type || PyObject_TypeCheck((x), &Track_Type))
|
||||
|
||||
typedef struct TrackObject {
|
||||
PyObject_HEAD
|
||||
|
@ -3482,7 +3482,7 @@ int TrackObj_Convert(PyObject *v, Track *p_itself)
|
|||
static void TrackObj_dealloc(TrackObject *self)
|
||||
{
|
||||
if (self->ob_itself) DisposeMovieTrack(self->ob_itself);
|
||||
Py_Type(self)->tp_free((PyObject *)self);
|
||||
Py_TYPE(self)->tp_free((PyObject *)self);
|
||||
}
|
||||
|
||||
static PyObject *TrackObj_LoadTrackIntoRam(TrackObject *_self, PyObject *_args)
|
||||
|
@ -4790,7 +4790,7 @@ PyTypeObject Track_Type = {
|
|||
|
||||
PyTypeObject Movie_Type;
|
||||
|
||||
#define MovieObj_Check(x) (Py_Type(x) == &Movie_Type || PyObject_TypeCheck((x), &Movie_Type))
|
||||
#define MovieObj_Check(x) (Py_TYPE(x) == &Movie_Type || PyObject_TypeCheck((x), &Movie_Type))
|
||||
|
||||
typedef struct MovieObject {
|
||||
PyObject_HEAD
|
||||
|
@ -4829,7 +4829,7 @@ int MovieObj_Convert(PyObject *v, Movie *p_itself)
|
|||
static void MovieObj_dealloc(MovieObject *self)
|
||||
{
|
||||
if (self->ob_itself) DisposeMovie(self->ob_itself);
|
||||
Py_Type(self)->tp_free((PyObject *)self);
|
||||
Py_TYPE(self)->tp_free((PyObject *)self);
|
||||
}
|
||||
|
||||
static PyObject *MovieObj_MoviesTask(MovieObject *_self, PyObject *_args)
|
||||
|
@ -7342,7 +7342,7 @@ PyTypeObject Movie_Type = {
|
|||
|
||||
PyTypeObject SGOutput_Type;
|
||||
|
||||
#define SGOutputObj_Check(x) (Py_Type(x) == &SGOutput_Type || PyObject_TypeCheck((x), &SGOutput_Type))
|
||||
#define SGOutputObj_Check(x) (Py_TYPE(x) == &SGOutput_Type || PyObject_TypeCheck((x), &SGOutput_Type))
|
||||
|
||||
typedef struct SGOutputObject {
|
||||
PyObject_HEAD
|
||||
|
@ -7381,7 +7381,7 @@ int SGOutputObj_Convert(PyObject *v, SGOutput *p_itself)
|
|||
static void SGOutputObj_dealloc(SGOutputObject *self)
|
||||
{
|
||||
/* Cleanup of self->ob_itself goes here */
|
||||
Py_Type(self)->tp_free((PyObject *)self);
|
||||
Py_TYPE(self)->tp_free((PyObject *)self);
|
||||
}
|
||||
|
||||
static PyMethodDef SGOutputObj_methods[] = {
|
||||
|
@ -28013,56 +28013,56 @@ void init_Qt(void)
|
|||
if (Qt_Error == NULL ||
|
||||
PyDict_SetItemString(d, "Error", Qt_Error) != 0)
|
||||
return;
|
||||
Py_Type(&IdleManager_Type) = &PyType_Type;
|
||||
Py_TYPE(&IdleManager_Type) = &PyType_Type;
|
||||
if (PyType_Ready(&IdleManager_Type) < 0) return;
|
||||
Py_INCREF(&IdleManager_Type);
|
||||
PyModule_AddObject(m, "IdleManager", (PyObject *)&IdleManager_Type);
|
||||
/* Backward-compatible name */
|
||||
Py_INCREF(&IdleManager_Type);
|
||||
PyModule_AddObject(m, "IdleManagerType", (PyObject *)&IdleManager_Type);
|
||||
Py_Type(&MovieController_Type) = &PyType_Type;
|
||||
Py_TYPE(&MovieController_Type) = &PyType_Type;
|
||||
if (PyType_Ready(&MovieController_Type) < 0) return;
|
||||
Py_INCREF(&MovieController_Type);
|
||||
PyModule_AddObject(m, "MovieController", (PyObject *)&MovieController_Type);
|
||||
/* Backward-compatible name */
|
||||
Py_INCREF(&MovieController_Type);
|
||||
PyModule_AddObject(m, "MovieControllerType", (PyObject *)&MovieController_Type);
|
||||
Py_Type(&TimeBase_Type) = &PyType_Type;
|
||||
Py_TYPE(&TimeBase_Type) = &PyType_Type;
|
||||
if (PyType_Ready(&TimeBase_Type) < 0) return;
|
||||
Py_INCREF(&TimeBase_Type);
|
||||
PyModule_AddObject(m, "TimeBase", (PyObject *)&TimeBase_Type);
|
||||
/* Backward-compatible name */
|
||||
Py_INCREF(&TimeBase_Type);
|
||||
PyModule_AddObject(m, "TimeBaseType", (PyObject *)&TimeBase_Type);
|
||||
Py_Type(&UserData_Type) = &PyType_Type;
|
||||
Py_TYPE(&UserData_Type) = &PyType_Type;
|
||||
if (PyType_Ready(&UserData_Type) < 0) return;
|
||||
Py_INCREF(&UserData_Type);
|
||||
PyModule_AddObject(m, "UserData", (PyObject *)&UserData_Type);
|
||||
/* Backward-compatible name */
|
||||
Py_INCREF(&UserData_Type);
|
||||
PyModule_AddObject(m, "UserDataType", (PyObject *)&UserData_Type);
|
||||
Py_Type(&Media_Type) = &PyType_Type;
|
||||
Py_TYPE(&Media_Type) = &PyType_Type;
|
||||
if (PyType_Ready(&Media_Type) < 0) return;
|
||||
Py_INCREF(&Media_Type);
|
||||
PyModule_AddObject(m, "Media", (PyObject *)&Media_Type);
|
||||
/* Backward-compatible name */
|
||||
Py_INCREF(&Media_Type);
|
||||
PyModule_AddObject(m, "MediaType", (PyObject *)&Media_Type);
|
||||
Py_Type(&Track_Type) = &PyType_Type;
|
||||
Py_TYPE(&Track_Type) = &PyType_Type;
|
||||
if (PyType_Ready(&Track_Type) < 0) return;
|
||||
Py_INCREF(&Track_Type);
|
||||
PyModule_AddObject(m, "Track", (PyObject *)&Track_Type);
|
||||
/* Backward-compatible name */
|
||||
Py_INCREF(&Track_Type);
|
||||
PyModule_AddObject(m, "TrackType", (PyObject *)&Track_Type);
|
||||
Py_Type(&Movie_Type) = &PyType_Type;
|
||||
Py_TYPE(&Movie_Type) = &PyType_Type;
|
||||
if (PyType_Ready(&Movie_Type) < 0) return;
|
||||
Py_INCREF(&Movie_Type);
|
||||
PyModule_AddObject(m, "Movie", (PyObject *)&Movie_Type);
|
||||
/* Backward-compatible name */
|
||||
Py_INCREF(&Movie_Type);
|
||||
PyModule_AddObject(m, "MovieType", (PyObject *)&Movie_Type);
|
||||
Py_Type(&SGOutput_Type) = &PyType_Type;
|
||||
Py_TYPE(&SGOutput_Type) = &PyType_Type;
|
||||
if (PyType_Ready(&SGOutput_Type) < 0) return;
|
||||
Py_INCREF(&SGOutput_Type);
|
||||
PyModule_AddObject(m, "SGOutput", (PyObject *)&SGOutput_Type);
|
||||
|
|
|
@ -41,7 +41,7 @@ static PyObject *Res_Error;
|
|||
|
||||
PyTypeObject Resource_Type;
|
||||
|
||||
#define ResObj_Check(x) (Py_Type(x) == &Resource_Type || PyObject_TypeCheck((x), &Resource_Type))
|
||||
#define ResObj_Check(x) (Py_TYPE(x) == &Resource_Type || PyObject_TypeCheck((x), &Resource_Type))
|
||||
|
||||
typedef struct ResourceObject {
|
||||
PyObject_HEAD
|
||||
|
@ -89,7 +89,7 @@ static void ResObj_dealloc(ResourceObject *self)
|
|||
self->ob_freeit(self->ob_itself);
|
||||
}
|
||||
self->ob_itself = NULL;
|
||||
Py_Type(self)->tp_free((PyObject *)self);
|
||||
Py_TYPE(self)->tp_free((PyObject *)self);
|
||||
}
|
||||
|
||||
static PyObject *ResObj_HomeResFile(ResourceObject *_self, PyObject *_args)
|
||||
|
@ -1730,7 +1730,7 @@ void init_Res(void)
|
|||
if (Res_Error == NULL ||
|
||||
PyDict_SetItemString(d, "Error", Res_Error) != 0)
|
||||
return;
|
||||
Py_Type(&Resource_Type) = &PyType_Type;
|
||||
Py_TYPE(&Resource_Type) = &PyType_Type;
|
||||
if (PyType_Ready(&Resource_Type) < 0) return;
|
||||
Py_INCREF(&Resource_Type);
|
||||
PyModule_AddObject(m, "Resource", (PyObject *)&Resource_Type);
|
||||
|
|
|
@ -23,7 +23,7 @@ static PyObject *Scrap_Error;
|
|||
|
||||
PyTypeObject Scrap_Type;
|
||||
|
||||
#define ScrapObj_Check(x) (Py_Type(x) == &Scrap_Type || PyObject_TypeCheck((x), &Scrap_Type))
|
||||
#define ScrapObj_Check(x) (Py_TYPE(x) == &Scrap_Type || PyObject_TypeCheck((x), &Scrap_Type))
|
||||
|
||||
typedef struct ScrapObject {
|
||||
PyObject_HEAD
|
||||
|
@ -52,7 +52,7 @@ int ScrapObj_Convert(PyObject *v, ScrapRef *p_itself)
|
|||
static void ScrapObj_dealloc(ScrapObject *self)
|
||||
{
|
||||
/* Cleanup of self->ob_itself goes here */
|
||||
Py_Type(self)->tp_free((PyObject *)self);
|
||||
Py_TYPE(self)->tp_free((PyObject *)self);
|
||||
}
|
||||
|
||||
static PyObject *ScrapObj_GetScrapFlavorFlags(ScrapObject *_self, PyObject *_args)
|
||||
|
@ -346,7 +346,7 @@ void init_Scrap(void)
|
|||
if (Scrap_Error == NULL ||
|
||||
PyDict_SetItemString(d, "Error", Scrap_Error) != 0)
|
||||
return;
|
||||
Py_Type(&Scrap_Type) = &PyType_Type;
|
||||
Py_TYPE(&Scrap_Type) = &PyType_Type;
|
||||
Py_INCREF(&Scrap_Type);
|
||||
if (PyDict_SetItemString(d, "ScrapType", (PyObject *)&Scrap_Type) != 0)
|
||||
Py_FatalError("can't initialize ScrapType");
|
||||
|
|
|
@ -42,7 +42,7 @@ static PyObject *Snd_Error;
|
|||
|
||||
static PyTypeObject SndChannel_Type;
|
||||
|
||||
#define SndCh_Check(x) (Py_Type(x) == &SndChannel_Type || PyObject_TypeCheck((x), &SndChannel_Type))
|
||||
#define SndCh_Check(x) (Py_TYPE(x) == &SndChannel_Type || PyObject_TypeCheck((x), &SndChannel_Type))
|
||||
|
||||
typedef struct SndChannelObject {
|
||||
PyObject_HEAD
|
||||
|
@ -256,7 +256,7 @@ static PyTypeObject SndChannel_Type = {
|
|||
|
||||
static PyTypeObject SPB_Type;
|
||||
|
||||
#define SPBObj_Check(x) (Py_Type(x) == &SPB_Type || PyObject_TypeCheck((x), &SPB_Type))
|
||||
#define SPBObj_Check(x) (Py_TYPE(x) == &SPB_Type || PyObject_TypeCheck((x), &SPB_Type))
|
||||
|
||||
typedef struct SPBObject {
|
||||
PyObject_HEAD
|
||||
|
@ -1129,14 +1129,14 @@ void init_Snd(void)
|
|||
if (Snd_Error == NULL ||
|
||||
PyDict_SetItemString(d, "Error", Snd_Error) != 0)
|
||||
return;
|
||||
Py_Type(&SndChannel_Type) = &PyType_Type;
|
||||
Py_TYPE(&SndChannel_Type) = &PyType_Type;
|
||||
if (PyType_Ready(&SndChannel_Type) < 0) return;
|
||||
Py_INCREF(&SndChannel_Type);
|
||||
PyModule_AddObject(m, "SndChannel", (PyObject *)&SndChannel_Type);
|
||||
/* Backward-compatible name */
|
||||
Py_INCREF(&SndChannel_Type);
|
||||
PyModule_AddObject(m, "SndChannelType", (PyObject *)&SndChannel_Type);
|
||||
Py_Type(&SPB_Type) = &PyType_Type;
|
||||
Py_TYPE(&SPB_Type) = &PyType_Type;
|
||||
if (PyType_Ready(&SPB_Type) < 0) return;
|
||||
Py_INCREF(&SPB_Type);
|
||||
PyModule_AddObject(m, "SPB", (PyObject *)&SPB_Type);
|
||||
|
|
|
@ -58,7 +58,7 @@ static PyObject *TE_Error;
|
|||
|
||||
PyTypeObject TE_Type;
|
||||
|
||||
#define TEObj_Check(x) (Py_Type(x) == &TE_Type || PyObject_TypeCheck((x), &TE_Type))
|
||||
#define TEObj_Check(x) (Py_TYPE(x) == &TE_Type || PyObject_TypeCheck((x), &TE_Type))
|
||||
|
||||
typedef struct TEObject {
|
||||
PyObject_HEAD
|
||||
|
@ -92,7 +92,7 @@ int TEObj_Convert(PyObject *v, TEHandle *p_itself)
|
|||
static void TEObj_dealloc(TEObject *self)
|
||||
{
|
||||
TEDispose(self->ob_itself);
|
||||
Py_Type(self)->tp_free((PyObject *)self);
|
||||
Py_TYPE(self)->tp_free((PyObject *)self);
|
||||
}
|
||||
|
||||
static PyObject *TEObj_TESetText(TEObject *_self, PyObject *_args)
|
||||
|
@ -1317,7 +1317,7 @@ void init_TE(void)
|
|||
if (TE_Error == NULL ||
|
||||
PyDict_SetItemString(d, "Error", TE_Error) != 0)
|
||||
return;
|
||||
Py_Type(&TE_Type) = &PyType_Type;
|
||||
Py_TYPE(&TE_Type) = &PyType_Type;
|
||||
if (PyType_Ready(&TE_Type) < 0) return;
|
||||
Py_INCREF(&TE_Type);
|
||||
PyModule_AddObject(m, "TE", (PyObject *)&TE_Type);
|
||||
|
|
|
@ -45,7 +45,7 @@ static PyObject *Win_Error;
|
|||
|
||||
PyTypeObject Window_Type;
|
||||
|
||||
#define WinObj_Check(x) (Py_Type(x) == &Window_Type || PyObject_TypeCheck((x), &Window_Type))
|
||||
#define WinObj_Check(x) (Py_TYPE(x) == &Window_Type || PyObject_TypeCheck((x), &Window_Type))
|
||||
|
||||
typedef struct WindowObject {
|
||||
PyObject_HEAD
|
||||
|
@ -102,7 +102,7 @@ static void WinObj_dealloc(WindowObject *self)
|
|||
}
|
||||
self->ob_itself = NULL;
|
||||
self->ob_freeit = NULL;
|
||||
Py_Type(self)->tp_free((PyObject *)self);
|
||||
Py_TYPE(self)->tp_free((PyObject *)self);
|
||||
}
|
||||
|
||||
static PyObject *WinObj_GetWindowOwnerCount(WindowObject *_self, PyObject *_args)
|
||||
|
@ -3244,7 +3244,7 @@ void init_Win(void)
|
|||
if (Win_Error == NULL ||
|
||||
PyDict_SetItemString(d, "Error", Win_Error) != 0)
|
||||
return;
|
||||
Py_Type(&Window_Type) = &PyType_Type;
|
||||
Py_TYPE(&Window_Type) = &PyType_Type;
|
||||
if (PyType_Ready(&Window_Type) < 0) return;
|
||||
Py_INCREF(&Window_Type);
|
||||
PyModule_AddObject(m, "Window", (PyObject *)&Window_Type);
|
||||
|
|
|
@ -203,13 +203,13 @@ static PyObject* DBPermissionsError; /* EPERM */
|
|||
|
||||
static PyTypeObject DB_Type, DBCursor_Type, DBEnv_Type, DBTxn_Type, DBLock_Type;
|
||||
|
||||
#define DBObject_Check(v) (Py_Type(v) == &DB_Type)
|
||||
#define DBCursorObject_Check(v) (Py_Type(v) == &DBCursor_Type)
|
||||
#define DBEnvObject_Check(v) (Py_Type(v) == &DBEnv_Type)
|
||||
#define DBTxnObject_Check(v) (Py_Type(v) == &DBTxn_Type)
|
||||
#define DBLockObject_Check(v) (Py_Type(v) == &DBLock_Type)
|
||||
#define DBObject_Check(v) (Py_TYPE(v) == &DB_Type)
|
||||
#define DBCursorObject_Check(v) (Py_TYPE(v) == &DBCursor_Type)
|
||||
#define DBEnvObject_Check(v) (Py_TYPE(v) == &DBEnv_Type)
|
||||
#define DBTxnObject_Check(v) (Py_TYPE(v) == &DBTxn_Type)
|
||||
#define DBLockObject_Check(v) (Py_TYPE(v) == &DBLock_Type)
|
||||
#if (DBVER >= 43)
|
||||
#define DBSequenceObject_Check(v) (Py_Type(v) == &DBSequence_Type)
|
||||
#define DBSequenceObject_Check(v) (Py_TYPE(v) == &DBSequence_Type)
|
||||
#endif
|
||||
|
||||
|
||||
|
@ -461,7 +461,7 @@ make_key_dbt(DBObject* self, PyObject* keyobj, DBT* key, int* pflags,
|
|||
else {
|
||||
PyErr_Format(PyExc_TypeError,
|
||||
"buffer or int object expected for key, %s found",
|
||||
Py_Type(keyobj)->tp_name);
|
||||
Py_TYPE(keyobj)->tp_name);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -611,7 +611,7 @@ static int makeDBError(int err)
|
|||
static void makeTypeError(char* expected, PyObject* found)
|
||||
{
|
||||
PyErr_Format(PyExc_TypeError, "Expected %s argument, %s found.",
|
||||
expected, Py_Type(found)->tp_name);
|
||||
expected, Py_TYPE(found)->tp_name);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1176,7 +1176,7 @@ _db_associateCallback(DB* db, const DBT* priKey, const DBT* priData,
|
|||
Py_ssize_t size;
|
||||
|
||||
CLEAR_DBT(*secKey);
|
||||
size = Py_Size(result);
|
||||
size = Py_SIZE(result);
|
||||
if (PyBytes_Check(result))
|
||||
data = PyBytes_AS_STRING(result);
|
||||
else
|
||||
|
@ -5656,13 +5656,13 @@ PyMODINIT_FUNC init_bsddb(void)
|
|||
|
||||
/* Initialize the type of the new type objects here; doing it here
|
||||
is required for portability to Windows without requiring C++. */
|
||||
Py_Type(&DB_Type) = &PyType_Type;
|
||||
Py_Type(&DBCursor_Type) = &PyType_Type;
|
||||
Py_Type(&DBEnv_Type) = &PyType_Type;
|
||||
Py_Type(&DBTxn_Type) = &PyType_Type;
|
||||
Py_Type(&DBLock_Type) = &PyType_Type;
|
||||
Py_TYPE(&DB_Type) = &PyType_Type;
|
||||
Py_TYPE(&DBCursor_Type) = &PyType_Type;
|
||||
Py_TYPE(&DBEnv_Type) = &PyType_Type;
|
||||
Py_TYPE(&DBTxn_Type) = &PyType_Type;
|
||||
Py_TYPE(&DBLock_Type) = &PyType_Type;
|
||||
#if (DBVER >= 43)
|
||||
Py_Type(&DBSequence_Type) = &PyType_Type;
|
||||
Py_TYPE(&DBSequence_Type) = &PyType_Type;
|
||||
#endif
|
||||
|
||||
|
||||
|
|
|
@ -583,7 +583,7 @@ deque_dealloc(dequeobject *deque)
|
|||
}
|
||||
deque->leftblock = NULL;
|
||||
deque->rightblock = NULL;
|
||||
Py_Type(deque)->tp_free(deque);
|
||||
Py_TYPE(deque)->tp_free(deque);
|
||||
}
|
||||
|
||||
static int
|
||||
|
@ -619,9 +619,9 @@ static PyObject *
|
|||
deque_copy(PyObject *deque)
|
||||
{
|
||||
if (((dequeobject *)deque)->maxlen == -1)
|
||||
return PyObject_CallFunction((PyObject *)(Py_Type(deque)), "O", deque, NULL);
|
||||
return PyObject_CallFunction((PyObject *)(Py_TYPE(deque)), "O", deque, NULL);
|
||||
else
|
||||
return PyObject_CallFunction((PyObject *)(Py_Type(deque)), "Oi",
|
||||
return PyObject_CallFunction((PyObject *)(Py_TYPE(deque)), "Oi",
|
||||
deque, ((dequeobject *)deque)->maxlen, NULL);
|
||||
}
|
||||
|
||||
|
@ -642,14 +642,14 @@ deque_reduce(dequeobject *deque)
|
|||
}
|
||||
if (dict == NULL) {
|
||||
if (deque->maxlen == -1)
|
||||
result = Py_BuildValue("O(O)", Py_Type(deque), aslist);
|
||||
result = Py_BuildValue("O(O)", Py_TYPE(deque), aslist);
|
||||
else
|
||||
result = Py_BuildValue("O(Oi)", Py_Type(deque), aslist, deque->maxlen);
|
||||
result = Py_BuildValue("O(Oi)", Py_TYPE(deque), aslist, deque->maxlen);
|
||||
} else {
|
||||
if (deque->maxlen == -1)
|
||||
result = Py_BuildValue("O(OO)O", Py_Type(deque), aslist, Py_None, dict);
|
||||
result = Py_BuildValue("O(OO)O", Py_TYPE(deque), aslist, Py_None, dict);
|
||||
else
|
||||
result = Py_BuildValue("O(Oi)O", Py_Type(deque), aslist, deque->maxlen, dict);
|
||||
result = Py_BuildValue("O(Oi)O", Py_TYPE(deque), aslist, deque->maxlen, dict);
|
||||
}
|
||||
Py_XDECREF(dict);
|
||||
Py_DECREF(aslist);
|
||||
|
@ -921,7 +921,7 @@ static void
|
|||
dequeiter_dealloc(dequeiterobject *dio)
|
||||
{
|
||||
Py_XDECREF(dio->deque);
|
||||
Py_Type(dio)->tp_free(dio);
|
||||
Py_TYPE(dio)->tp_free(dio);
|
||||
}
|
||||
|
||||
static PyObject *
|
||||
|
@ -1129,7 +1129,7 @@ defdict_copy(defdictobject *dd)
|
|||
whose class constructor has the same signature. Subclasses that
|
||||
define a different constructor signature must override copy().
|
||||
*/
|
||||
return PyObject_CallFunctionObjArgs((PyObject*)Py_Type(dd),
|
||||
return PyObject_CallFunctionObjArgs((PyObject*)Py_TYPE(dd),
|
||||
dd->default_factory, dd, NULL);
|
||||
}
|
||||
|
||||
|
@ -1172,7 +1172,7 @@ defdict_reduce(defdictobject *dd)
|
|||
Py_DECREF(args);
|
||||
return NULL;
|
||||
}
|
||||
result = PyTuple_Pack(5, Py_Type(dd), args,
|
||||
result = PyTuple_Pack(5, Py_TYPE(dd), args,
|
||||
Py_None, Py_None, items);
|
||||
Py_DECREF(items);
|
||||
Py_DECREF(args);
|
||||
|
|
|
@ -81,7 +81,7 @@ typedef struct {
|
|||
|
||||
static PyTypeObject Reader_Type;
|
||||
|
||||
#define ReaderObject_Check(v) (Py_Type(v) == &Reader_Type)
|
||||
#define ReaderObject_Check(v) (Py_TYPE(v) == &Reader_Type)
|
||||
|
||||
typedef struct {
|
||||
PyObject_HEAD
|
||||
|
@ -284,7 +284,7 @@ static void
|
|||
Dialect_dealloc(DialectObj *self)
|
||||
{
|
||||
Py_XDECREF(self->lineterminator);
|
||||
Py_Type(self)->tp_free((PyObject *)self);
|
||||
Py_TYPE(self)->tp_free((PyObject *)self);
|
||||
}
|
||||
|
||||
static char *dialect_kws[] = {
|
||||
|
|
|
@ -328,7 +328,7 @@ CDataType_from_param(PyObject *type, PyObject *value)
|
|||
Py_INCREF(value);
|
||||
return value;
|
||||
}
|
||||
ob_name = (ob) ? Py_Type(ob)->tp_name : "???";
|
||||
ob_name = (ob) ? Py_TYPE(ob)->tp_name : "???";
|
||||
PyErr_Format(PyExc_TypeError,
|
||||
"expected %s instance instead of pointer to %s",
|
||||
((PyTypeObject *)type)->tp_name, ob_name);
|
||||
|
@ -344,7 +344,7 @@ CDataType_from_param(PyObject *type, PyObject *value)
|
|||
PyErr_Format(PyExc_TypeError,
|
||||
"expected %s instance instead of %s",
|
||||
((PyTypeObject *)type)->tp_name,
|
||||
Py_Type(value)->tp_name);
|
||||
Py_TYPE(value)->tp_name);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -798,7 +798,7 @@ CharArray_set_value(CDataObject *self, PyObject *value)
|
|||
} else if (!PyString_Check(value)) {
|
||||
PyErr_Format(PyExc_TypeError,
|
||||
"str/bytes expected instead of %s instance",
|
||||
Py_Type(value)->tp_name);
|
||||
Py_TYPE(value)->tp_name);
|
||||
return -1;
|
||||
} else
|
||||
Py_INCREF(value);
|
||||
|
@ -858,7 +858,7 @@ WCharArray_set_value(CDataObject *self, PyObject *value)
|
|||
} else if (!PyUnicode_Check(value)) {
|
||||
PyErr_Format(PyExc_TypeError,
|
||||
"unicode string expected instead of %s instance",
|
||||
Py_Type(value)->tp_name);
|
||||
Py_TYPE(value)->tp_name);
|
||||
return -1;
|
||||
} else
|
||||
Py_INCREF(value);
|
||||
|
@ -2075,7 +2075,7 @@ static void
|
|||
CData_dealloc(PyObject *self)
|
||||
{
|
||||
CData_clear((CDataObject *)self);
|
||||
Py_Type(self)->tp_free(self);
|
||||
Py_TYPE(self)->tp_free(self);
|
||||
}
|
||||
|
||||
static PyMemberDef CData_members[] = {
|
||||
|
@ -2334,7 +2334,7 @@ _CData_set(CDataObject *dst, PyObject *type, SETFUNC setfunc, PyObject *value,
|
|||
PyErr_Format(PyExc_TypeError,
|
||||
"expected %s instance, got %s",
|
||||
((PyTypeObject *)type)->tp_name,
|
||||
Py_Type(value)->tp_name);
|
||||
Py_TYPE(value)->tp_name);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
@ -2365,7 +2365,7 @@ _CData_set(CDataObject *dst, PyObject *type, SETFUNC setfunc, PyObject *value,
|
|||
if (p1->proto != p2->proto) {
|
||||
PyErr_Format(PyExc_TypeError,
|
||||
"incompatible types, %s instance instead of %s instance",
|
||||
Py_Type(value)->tp_name,
|
||||
Py_TYPE(value)->tp_name,
|
||||
((PyTypeObject *)type)->tp_name);
|
||||
return NULL;
|
||||
}
|
||||
|
@ -2384,7 +2384,7 @@ _CData_set(CDataObject *dst, PyObject *type, SETFUNC setfunc, PyObject *value,
|
|||
}
|
||||
PyErr_Format(PyExc_TypeError,
|
||||
"incompatible types, %s instance instead of %s instance",
|
||||
Py_Type(value)->tp_name,
|
||||
Py_TYPE(value)->tp_name,
|
||||
((PyTypeObject *)type)->tp_name);
|
||||
return NULL;
|
||||
}
|
||||
|
@ -2645,7 +2645,7 @@ _check_outarg_type(PyObject *arg, Py_ssize_t index)
|
|||
Py_SAFE_DOWNCAST(index, Py_ssize_t, int),
|
||||
PyType_Check(arg) ?
|
||||
((PyTypeObject *)arg)->tp_name :
|
||||
Py_Type(arg)->tp_name);
|
||||
Py_TYPE(arg)->tp_name);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -3430,7 +3430,7 @@ static void
|
|||
CFuncPtr_dealloc(CFuncPtrObject *self)
|
||||
{
|
||||
CFuncPtr_clear(self);
|
||||
Py_Type(self)->tp_free((PyObject *)self);
|
||||
Py_TYPE(self)->tp_free((PyObject *)self);
|
||||
}
|
||||
|
||||
static PyObject *
|
||||
|
@ -3440,11 +3440,11 @@ CFuncPtr_repr(CFuncPtrObject *self)
|
|||
if (self->index)
|
||||
return PyUnicode_FromFormat("<COM method offset %d: %s at %p>",
|
||||
self->index - 0x1000,
|
||||
Py_Type(self)->tp_name,
|
||||
Py_TYPE(self)->tp_name,
|
||||
self);
|
||||
#endif
|
||||
return PyUnicode_FromFormat("<%s object at %p>",
|
||||
Py_Type(self)->tp_name,
|
||||
Py_TYPE(self)->tp_name,
|
||||
self);
|
||||
}
|
||||
|
||||
|
@ -4078,7 +4078,7 @@ static PyGetSetDef Simple_getsets[] = {
|
|||
static PyObject *
|
||||
Simple_from_outparm(PyObject *self, PyObject *args)
|
||||
{
|
||||
if (IsSimpleSubType((PyObject *)Py_Type(self))) {
|
||||
if (IsSimpleSubType((PyObject *)Py_TYPE(self))) {
|
||||
Py_INCREF(self);
|
||||
return self;
|
||||
}
|
||||
|
@ -4116,9 +4116,9 @@ Simple_repr(CDataObject *self)
|
|||
PyObject *val, *name, *args, *result;
|
||||
static PyObject *format;
|
||||
|
||||
if (Py_Type(self)->tp_base != &Simple_Type) {
|
||||
if (Py_TYPE(self)->tp_base != &Simple_Type) {
|
||||
return PyUnicode_FromFormat("<%s object at %p>",
|
||||
Py_Type(self)->tp_name, self);
|
||||
Py_TYPE(self)->tp_name, self);
|
||||
}
|
||||
|
||||
if (format == NULL) {
|
||||
|
@ -4131,7 +4131,7 @@ Simple_repr(CDataObject *self)
|
|||
if (val == NULL)
|
||||
return NULL;
|
||||
|
||||
name = PyUnicode_FromString(Py_Type(self)->tp_name);
|
||||
name = PyUnicode_FromString(Py_TYPE(self)->tp_name);
|
||||
if (name == NULL) {
|
||||
Py_DECREF(val);
|
||||
return NULL;
|
||||
|
@ -4302,7 +4302,7 @@ Pointer_set_contents(CDataObject *self, PyObject *value, void *closure)
|
|||
PyErr_Format(PyExc_TypeError,
|
||||
"expected %s instead of %s",
|
||||
((PyTypeObject *)(stgdict->proto))->tp_name,
|
||||
Py_Type(value)->tp_name);
|
||||
Py_TYPE(value)->tp_name);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -4588,7 +4588,7 @@ comerror_init(PyObject *self, PyObject *args, PyObject *kwds)
|
|||
PyObject *a;
|
||||
int status;
|
||||
|
||||
if (!_PyArg_NoKeywords(Py_Type(self)->tp_name, kwds))
|
||||
if (!_PyArg_NoKeywords(Py_TYPE(self)->tp_name, kwds))
|
||||
return -1;
|
||||
|
||||
if (!PyArg_ParseTuple(args, "OOO:COMError", &hresult, &text, &details))
|
||||
|
@ -4703,7 +4703,7 @@ cast_check_pointertype(PyObject *arg)
|
|||
"cast() argument 2 must be a pointer type, not %s",
|
||||
PyType_Check(arg)
|
||||
? ((PyTypeObject *)arg)->tp_name
|
||||
: Py_Type(arg)->tp_name);
|
||||
: Py_TYPE(arg)->tp_name);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -4830,37 +4830,37 @@ init_ctypes(void)
|
|||
if (PyType_Ready(&CData_Type) < 0)
|
||||
return;
|
||||
|
||||
Py_Type(&Struct_Type) = &StructType_Type;
|
||||
Py_TYPE(&Struct_Type) = &StructType_Type;
|
||||
Struct_Type.tp_base = &CData_Type;
|
||||
if (PyType_Ready(&Struct_Type) < 0)
|
||||
return;
|
||||
PyModule_AddObject(m, "Structure", (PyObject *)&Struct_Type);
|
||||
|
||||
Py_Type(&Union_Type) = &UnionType_Type;
|
||||
Py_TYPE(&Union_Type) = &UnionType_Type;
|
||||
Union_Type.tp_base = &CData_Type;
|
||||
if (PyType_Ready(&Union_Type) < 0)
|
||||
return;
|
||||
PyModule_AddObject(m, "Union", (PyObject *)&Union_Type);
|
||||
|
||||
Py_Type(&Pointer_Type) = &PointerType_Type;
|
||||
Py_TYPE(&Pointer_Type) = &PointerType_Type;
|
||||
Pointer_Type.tp_base = &CData_Type;
|
||||
if (PyType_Ready(&Pointer_Type) < 0)
|
||||
return;
|
||||
PyModule_AddObject(m, "_Pointer", (PyObject *)&Pointer_Type);
|
||||
|
||||
Py_Type(&Array_Type) = &ArrayType_Type;
|
||||
Py_TYPE(&Array_Type) = &ArrayType_Type;
|
||||
Array_Type.tp_base = &CData_Type;
|
||||
if (PyType_Ready(&Array_Type) < 0)
|
||||
return;
|
||||
PyModule_AddObject(m, "Array", (PyObject *)&Array_Type);
|
||||
|
||||
Py_Type(&Simple_Type) = &SimpleType_Type;
|
||||
Py_TYPE(&Simple_Type) = &SimpleType_Type;
|
||||
Simple_Type.tp_base = &CData_Type;
|
||||
if (PyType_Ready(&Simple_Type) < 0)
|
||||
return;
|
||||
PyModule_AddObject(m, "_SimpleCData", (PyObject *)&Simple_Type);
|
||||
|
||||
Py_Type(&CFuncPtr_Type) = &CFuncPtrType_Type;
|
||||
Py_TYPE(&CFuncPtr_Type) = &CFuncPtrType_Type;
|
||||
CFuncPtr_Type.tp_base = &CData_Type;
|
||||
if (PyType_Ready(&CFuncPtr_Type) < 0)
|
||||
return;
|
||||
|
|
|
@ -1153,7 +1153,7 @@ call_commethod(PyObject *self, PyObject *args)
|
|||
if (!CDataObject_Check(pcom) || (pcom->b_size != sizeof(void *))) {
|
||||
PyErr_Format(PyExc_TypeError,
|
||||
"COM Pointer expected instead of %s instance",
|
||||
Py_Type(pcom)->tp_name);
|
||||
Py_TYPE(pcom)->tp_name);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -1393,7 +1393,7 @@ byref(PyObject *self, PyObject *obj)
|
|||
if (!CDataObject_Check(obj)) {
|
||||
PyErr_Format(PyExc_TypeError,
|
||||
"byref() argument must be a ctypes instance, not '%s'",
|
||||
Py_Type(obj)->tp_name);
|
||||
Py_TYPE(obj)->tp_name);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
|
@ -1349,7 +1349,7 @@ s_set(void *ptr, PyObject *value, Py_ssize_t length)
|
|||
data = PyString_AS_STRING(value);
|
||||
if (!data)
|
||||
return NULL;
|
||||
size = strlen(data); /* XXX Why not Py_Size(value)? */
|
||||
size = strlen(data); /* XXX Why not Py_SIZE(value)? */
|
||||
if (size < length) {
|
||||
/* This will copy the leading NUL character
|
||||
* if there is space for it.
|
||||
|
|
|
@ -183,7 +183,7 @@ MakeFields(PyObject *type, CFieldObject *descr,
|
|||
Py_DECREF(fieldlist);
|
||||
return -1;
|
||||
}
|
||||
if (Py_Type(fdescr) != &CField_Type) {
|
||||
if (Py_TYPE(fdescr) != &CField_Type) {
|
||||
PyErr_SetString(PyExc_TypeError, "unexpected type");
|
||||
Py_DECREF(fdescr);
|
||||
Py_DECREF(fieldlist);
|
||||
|
@ -206,7 +206,7 @@ MakeFields(PyObject *type, CFieldObject *descr,
|
|||
Py_DECREF(fieldlist);
|
||||
return -1;
|
||||
}
|
||||
assert(Py_Type(new_descr) == &CField_Type);
|
||||
assert(Py_TYPE(new_descr) == &CField_Type);
|
||||
new_descr->size = fdescr->size;
|
||||
new_descr->offset = fdescr->offset + offset;
|
||||
new_descr->index = fdescr->index + index;
|
||||
|
@ -254,7 +254,7 @@ MakeAnonFields(PyObject *type)
|
|||
Py_DECREF(anon_names);
|
||||
return -1;
|
||||
}
|
||||
assert(Py_Type(descr) == &CField_Type);
|
||||
assert(Py_TYPE(descr) == &CField_Type);
|
||||
descr->anonymous = 1;
|
||||
|
||||
/* descr is in the field descriptor. */
|
||||
|
|
|
@ -56,7 +56,7 @@ typedef struct {
|
|||
|
||||
PyTypeObject PyCursesPanel_Type;
|
||||
|
||||
#define PyCursesPanel_Check(v) (Py_Type(v) == &PyCursesPanel_Type)
|
||||
#define PyCursesPanel_Check(v) (Py_TYPE(v) == &PyCursesPanel_Type)
|
||||
|
||||
/* Some helper functions. The problem is that there's always a window
|
||||
associated with a panel. To ensure that Python's GC doesn't pull
|
||||
|
@ -457,7 +457,7 @@ init_curses_panel(void)
|
|||
PyObject *m, *d, *v;
|
||||
|
||||
/* Initialize object type */
|
||||
Py_Type(&PyCursesPanel_Type) = &PyType_Type;
|
||||
Py_TYPE(&PyCursesPanel_Type) = &PyType_Type;
|
||||
|
||||
import_curses();
|
||||
|
||||
|
|
|
@ -2709,7 +2709,7 @@ init_curses(void)
|
|||
static void *PyCurses_API[PyCurses_API_pointers];
|
||||
|
||||
/* Initialize object type */
|
||||
Py_Type(&PyCursesWindow_Type) = &PyType_Type;
|
||||
Py_TYPE(&PyCursesWindow_Type) = &PyType_Type;
|
||||
|
||||
/* Initialize the C API pointer array */
|
||||
PyCurses_API[0] = (void *)&PyCursesWindow_Type;
|
||||
|
|
|
@ -248,7 +248,7 @@ typedef struct {
|
|||
|
||||
static PyTypeObject Element_Type;
|
||||
|
||||
#define Element_CheckExact(op) (Py_Type(op) == &Element_Type)
|
||||
#define Element_CheckExact(op) (Py_TYPE(op) == &Element_Type)
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
/* element constructor and destructor */
|
||||
|
@ -1174,7 +1174,7 @@ element_setslice(PyObject* self_, Py_ssize_t start, Py_ssize_t end, PyObject* it
|
|||
/* FIXME: support arbitrary sequences? */
|
||||
PyErr_Format(
|
||||
PyExc_TypeError,
|
||||
"expected list, not \"%.200s\"", Py_Type(item)->tp_name
|
||||
"expected list, not \"%.200s\"", Py_TYPE(item)->tp_name
|
||||
);
|
||||
return -1;
|
||||
}
|
||||
|
@ -1407,7 +1407,7 @@ typedef struct {
|
|||
|
||||
static PyTypeObject TreeBuilder_Type;
|
||||
|
||||
#define TreeBuilder_CheckExact(op) (Py_Type(op) == &TreeBuilder_Type)
|
||||
#define TreeBuilder_CheckExact(op) (Py_TYPE(op) == &TreeBuilder_Type)
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
/* constructor and destructor */
|
||||
|
@ -1574,7 +1574,7 @@ treebuilder_handle_data(TreeBuilderObject* self, PyObject* data)
|
|||
Py_INCREF(data); self->data = data;
|
||||
} else {
|
||||
/* more than one item; use a list to collect items */
|
||||
if (PyString_CheckExact(self->data) && Py_Refcnt(self->data) == 1 &&
|
||||
if (PyString_CheckExact(self->data) && Py_REFCNT(self->data) == 1 &&
|
||||
PyString_CheckExact(data) && PyString_GET_SIZE(data) == 1) {
|
||||
/* expat often generates single character data sections; handle
|
||||
the most common case by resizing the existing string... */
|
||||
|
@ -2550,9 +2550,9 @@ init_elementtree(void)
|
|||
#endif
|
||||
|
||||
/* Patch object type */
|
||||
Py_Type(&Element_Type) = Py_Type(&TreeBuilder_Type) = &PyType_Type;
|
||||
Py_TYPE(&Element_Type) = Py_TYPE(&TreeBuilder_Type) = &PyType_Type;
|
||||
#if defined(USE_EXPAT)
|
||||
Py_Type(&XMLParser_Type) = &PyType_Type;
|
||||
Py_TYPE(&XMLParser_Type) = &PyType_Type;
|
||||
#endif
|
||||
|
||||
m = Py_InitModule("_elementtree", _functions);
|
||||
|
|
|
@ -304,7 +304,7 @@ fileio_dealloc(PyFileIOObject *self)
|
|||
}
|
||||
}
|
||||
|
||||
Py_Type(self)->tp_free((PyObject *)self);
|
||||
Py_TYPE(self)->tp_free((PyObject *)self);
|
||||
}
|
||||
|
||||
static PyObject *
|
||||
|
|
|
@ -81,7 +81,7 @@ partial_dealloc(partialobject *pto)
|
|||
Py_XDECREF(pto->args);
|
||||
Py_XDECREF(pto->kw);
|
||||
Py_XDECREF(pto->dict);
|
||||
Py_Type(pto)->tp_free(pto);
|
||||
Py_TYPE(pto)->tp_free(pto);
|
||||
}
|
||||
|
||||
static PyObject *
|
||||
|
|
|
@ -510,7 +510,7 @@ init_hashlib(void)
|
|||
* but having some be unsupported. Only init appropriate
|
||||
* constants. */
|
||||
|
||||
Py_Type(&EVPtype) = &PyType_Type;
|
||||
Py_TYPE(&EVPtype) = &PyType_Type;
|
||||
if (PyType_Ready(&EVPtype) < 0)
|
||||
return;
|
||||
|
||||
|
|
|
@ -120,7 +120,7 @@ typedef struct {
|
|||
static PyTypeObject PyProfiler_Type;
|
||||
|
||||
#define PyProfiler_Check(op) PyObject_TypeCheck(op, &PyProfiler_Type)
|
||||
#define PyProfiler_CheckExact(op) (Py_Type(op) == &PyProfiler_Type)
|
||||
#define PyProfiler_CheckExact(op) (Py_TYPE(op) == &PyProfiler_Type)
|
||||
|
||||
/*** External Timers ***/
|
||||
|
||||
|
@ -207,7 +207,7 @@ normalizeUserObj(PyObject *obj)
|
|||
PyObject *self = fn->m_self;
|
||||
PyObject *name = PyUnicode_FromString(fn->m_ml->ml_name);
|
||||
if (name != NULL) {
|
||||
PyObject *mo = _PyType_Lookup(Py_Type(self), name);
|
||||
PyObject *mo = _PyType_Lookup(Py_TYPE(self), name);
|
||||
Py_XINCREF(mo);
|
||||
Py_DECREF(name);
|
||||
if (mo != NULL) {
|
||||
|
@ -756,7 +756,7 @@ profiler_dealloc(ProfilerObject *op)
|
|||
flush_unmatched(op);
|
||||
clearEntries(op);
|
||||
Py_XDECREF(op->externalTimer);
|
||||
Py_Type(op)->tp_free(op);
|
||||
Py_TYPE(op)->tp_free(op);
|
||||
}
|
||||
|
||||
static int
|
||||
|
|
|
@ -84,7 +84,7 @@ typedef struct {
|
|||
|
||||
static PyTypeObject Random_Type;
|
||||
|
||||
#define RandomObject_Check(v) (Py_Type(v) == &Random_Type)
|
||||
#define RandomObject_Check(v) (Py_TYPE(v) == &Random_Type)
|
||||
|
||||
|
||||
/* Random methods */
|
||||
|
@ -405,7 +405,7 @@ random_jumpahead(RandomObject *self, PyObject *n)
|
|||
if (!PyLong_Check(n)) {
|
||||
PyErr_Format(PyExc_TypeError, "jumpahead requires an "
|
||||
"integer, not '%s'",
|
||||
Py_Type(n)->tp_name);
|
||||
Py_TYPE(n)->tp_name);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
|
@ -51,7 +51,7 @@ void pysqlite_node_dealloc(pysqlite_Node* self)
|
|||
Py_DECREF(self->key);
|
||||
Py_DECREF(self->data);
|
||||
|
||||
Py_Type(self)->tp_free((PyObject*)self);
|
||||
Py_TYPE(self)->tp_free((PyObject*)self);
|
||||
}
|
||||
|
||||
int pysqlite_cache_init(pysqlite_Cache* self, PyObject* args, PyObject* kwargs)
|
||||
|
@ -109,7 +109,7 @@ void pysqlite_cache_dealloc(pysqlite_Cache* self)
|
|||
}
|
||||
Py_DECREF(self->mapping);
|
||||
|
||||
Py_Type(self)->tp_free((PyObject*)self);
|
||||
Py_TYPE(self)->tp_free((PyObject*)self);
|
||||
}
|
||||
|
||||
PyObject* pysqlite_cache_get(pysqlite_Cache* self, PyObject* args)
|
||||
|
|
|
@ -205,7 +205,7 @@ void pysqlite_connection_dealloc(pysqlite_Connection* self)
|
|||
Py_XDECREF(self->collations);
|
||||
Py_XDECREF(self->statements);
|
||||
|
||||
Py_Type(self)->tp_free((PyObject*)self);
|
||||
Py_TYPE(self)->tp_free((PyObject*)self);
|
||||
}
|
||||
|
||||
PyObject* pysqlite_connection_cursor(pysqlite_Connection* self, PyObject* args, PyObject* kwargs)
|
||||
|
|
|
@ -134,7 +134,7 @@ void pysqlite_cursor_dealloc(pysqlite_Cursor* self)
|
|||
Py_XDECREF(self->row_factory);
|
||||
Py_XDECREF(self->next_row);
|
||||
|
||||
Py_Type(self)->tp_free((PyObject*)self);
|
||||
Py_TYPE(self)->tp_free((PyObject*)self);
|
||||
}
|
||||
|
||||
PyObject* _pysqlite_get_converter(PyObject* key)
|
||||
|
|
|
@ -30,7 +30,7 @@ int pysqlite_prepare_protocol_init(pysqlite_PrepareProtocol* self, PyObject* arg
|
|||
|
||||
void pysqlite_prepare_protocol_dealloc(pysqlite_PrepareProtocol* self)
|
||||
{
|
||||
Py_Type(self)->tp_free((PyObject*)self);
|
||||
Py_TYPE(self)->tp_free((PyObject*)self);
|
||||
}
|
||||
|
||||
PyTypeObject pysqlite_PrepareProtocolType= {
|
||||
|
@ -78,6 +78,6 @@ PyTypeObject pysqlite_PrepareProtocolType= {
|
|||
extern int pysqlite_prepare_protocol_setup_types(void)
|
||||
{
|
||||
pysqlite_PrepareProtocolType.tp_new = PyType_GenericNew;
|
||||
Py_Type(&pysqlite_PrepareProtocolType)= &PyType_Type;
|
||||
Py_TYPE(&pysqlite_PrepareProtocolType)= &PyType_Type;
|
||||
return PyType_Ready(&pysqlite_PrepareProtocolType);
|
||||
}
|
||||
|
|
|
@ -30,7 +30,7 @@ void pysqlite_row_dealloc(pysqlite_Row* self)
|
|||
Py_XDECREF(self->data);
|
||||
Py_XDECREF(self->description);
|
||||
|
||||
Py_Type(self)->tp_free((PyObject*)self);
|
||||
Py_TYPE(self)->tp_free((PyObject*)self);
|
||||
}
|
||||
|
||||
int pysqlite_row_init(pysqlite_Row* self, PyObject* args, PyObject* kwargs)
|
||||
|
|
|
@ -307,7 +307,7 @@ void pysqlite_statement_dealloc(pysqlite_Statement* self)
|
|||
PyObject_ClearWeakRefs((PyObject*)self);
|
||||
}
|
||||
|
||||
Py_Type(self)->tp_free((PyObject*)self);
|
||||
Py_TYPE(self)->tp_free((PyObject*)self);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -1685,7 +1685,7 @@ getstring(PyObject* string, Py_ssize_t* p_length, int* p_charsize)
|
|||
|
||||
/* get pointer to string buffer */
|
||||
view.len = -1;
|
||||
buffer = Py_Type(string)->tp_as_buffer;
|
||||
buffer = Py_TYPE(string)->tp_as_buffer;
|
||||
if (!buffer || !buffer->bf_getbuffer ||
|
||||
(*buffer->bf_getbuffer)(string, &view, PyBUF_SIMPLE) < 0) {
|
||||
PyErr_SetString(PyExc_TypeError, "expected string or buffer");
|
||||
|
|
|
@ -127,7 +127,7 @@ static int check_socket_and_wait_for_timeout(PySocketSockObject *s,
|
|||
static PyObject *PySSL_peercert(PySSLObject *self, PyObject *args);
|
||||
static PyObject *PySSL_cipher(PySSLObject *self);
|
||||
|
||||
#define PySSLObject_Check(v) (Py_Type(v) == &PySSL_Type)
|
||||
#define PySSLObject_Check(v) (Py_TYPE(v) == &PySSL_Type)
|
||||
|
||||
typedef enum {
|
||||
SOCKET_IS_NONBLOCKING,
|
||||
|
@ -1451,7 +1451,7 @@ PySSL_RAND_egd(PyObject *self, PyObject *arg)
|
|||
if (!PyUnicode_Check(arg))
|
||||
return PyErr_Format(PyExc_TypeError,
|
||||
"RAND_egd() expected string, found %s",
|
||||
Py_Type(arg)->tp_name);
|
||||
Py_TYPE(arg)->tp_name);
|
||||
bytes = RAND_egd(PyUnicode_AsString(arg));
|
||||
if (bytes == -1) {
|
||||
PyErr_SetString(PySSLErrorObject,
|
||||
|
@ -1568,7 +1568,7 @@ init_ssl(void)
|
|||
{
|
||||
PyObject *m, *d;
|
||||
|
||||
Py_Type(&PySSL_Type) = &PyType_Type;
|
||||
Py_TYPE(&PySSL_Type) = &PyType_Type;
|
||||
|
||||
m = Py_InitModule3("_ssl", PySSL_methods, module_doc);
|
||||
if (m == NULL)
|
||||
|
|
|
@ -67,7 +67,7 @@ typedef struct {
|
|||
|
||||
|
||||
#define PyStruct_Check(op) PyObject_TypeCheck(op, &PyStructType)
|
||||
#define PyStruct_CheckExact(op) (Py_Type(op) == &PyStructType)
|
||||
#define PyStruct_CheckExact(op) (Py_TYPE(op) == &PyStructType)
|
||||
|
||||
|
||||
/* Exception */
|
||||
|
@ -126,7 +126,7 @@ get_pylong(PyObject *v)
|
|||
Py_INCREF(v);
|
||||
return v;
|
||||
}
|
||||
m = Py_Type(v)->tp_as_number;
|
||||
m = Py_TYPE(v)->tp_as_number;
|
||||
if (m != NULL && m->nb_long != NULL) {
|
||||
v = m->nb_long(v);
|
||||
if (v == NULL)
|
||||
|
@ -1485,7 +1485,7 @@ s_dealloc(PyStructObject *s)
|
|||
PyMem_FREE(s->s_codes);
|
||||
}
|
||||
Py_XDECREF(s->s_format);
|
||||
Py_Type(s)->tp_free((PyObject *)s);
|
||||
Py_TYPE(s)->tp_free((PyObject *)s);
|
||||
}
|
||||
|
||||
static PyObject *
|
||||
|
@ -1870,7 +1870,7 @@ init_struct(void)
|
|||
if (m == NULL)
|
||||
return;
|
||||
|
||||
Py_Type(&PyStructType) = &PyType_Type;
|
||||
Py_TYPE(&PyStructType) = &PyType_Type;
|
||||
if (PyType_Ready(&PyStructType) < 0)
|
||||
return;
|
||||
|
||||
|
|
|
@ -1057,7 +1057,7 @@ init_testcapi(void)
|
|||
if (m == NULL)
|
||||
return;
|
||||
|
||||
Py_Type(&test_structmembersType)=&PyType_Type;
|
||||
Py_TYPE(&test_structmembersType)=&PyType_Type;
|
||||
Py_INCREF(&test_structmembersType);
|
||||
PyModule_AddObject(m, "test_structmembersType", (PyObject *)&test_structmembersType);
|
||||
|
||||
|
|
|
@ -262,12 +262,12 @@ typedef struct {
|
|||
Tcl_ObjType *StringType;
|
||||
} TkappObject;
|
||||
|
||||
#define Tkapp_Check(v) (Py_Type(v) == &Tkapp_Type)
|
||||
#define Tkapp_Check(v) (Py_TYPE(v) == &Tkapp_Type)
|
||||
#define Tkapp_Interp(v) (((TkappObject *) (v))->interp)
|
||||
#define Tkapp_Result(v) Tcl_GetStringResult(Tkapp_Interp(v))
|
||||
|
||||
#define DEBUG_REFCNT(v) (printf("DEBUG: id=%p, refcnt=%i\n", \
|
||||
(void *) v, Py_Refcnt(v)))
|
||||
(void *) v, Py_REFCNT(v)))
|
||||
|
||||
|
||||
|
||||
|
@ -3016,7 +3016,7 @@ init_tkinter(void)
|
|||
{
|
||||
PyObject *m, *d;
|
||||
|
||||
Py_Type(&Tkapp_Type) = &PyType_Type;
|
||||
Py_TYPE(&Tkapp_Type) = &PyType_Type;
|
||||
|
||||
#ifdef WITH_THREAD
|
||||
tcl_lock = PyThread_allocate_lock();
|
||||
|
@ -3044,10 +3044,10 @@ init_tkinter(void)
|
|||
|
||||
PyDict_SetItemString(d, "TkappType", (PyObject *)&Tkapp_Type);
|
||||
|
||||
Py_Type(&Tktt_Type) = &PyType_Type;
|
||||
Py_TYPE(&Tktt_Type) = &PyType_Type;
|
||||
PyDict_SetItemString(d, "TkttType", (PyObject *)&Tktt_Type);
|
||||
|
||||
Py_Type(&PyTclObject_Type) = &PyType_Type;
|
||||
Py_TYPE(&PyTclObject_Type) = &PyType_Type;
|
||||
PyDict_SetItemString(d, "Tcl_Obj", (PyObject *)&PyTclObject_Type);
|
||||
|
||||
#ifdef TK_AQUA
|
||||
|
|
|
@ -14,7 +14,7 @@ weakref_getweakrefcount(PyObject *self, PyObject *object)
|
|||
{
|
||||
PyObject *result = NULL;
|
||||
|
||||
if (PyType_SUPPORTS_WEAKREFS(Py_Type(object))) {
|
||||
if (PyType_SUPPORTS_WEAKREFS(Py_TYPE(object))) {
|
||||
PyWeakReference **list = GET_WEAKREFS_LISTPTR(object);
|
||||
|
||||
result = PyLong_FromSsize_t(_PyWeakref_GetWeakrefCount(*list));
|
||||
|
@ -35,7 +35,7 @@ weakref_getweakrefs(PyObject *self, PyObject *object)
|
|||
{
|
||||
PyObject *result = NULL;
|
||||
|
||||
if (PyType_SUPPORTS_WEAKREFS(Py_Type(object))) {
|
||||
if (PyType_SUPPORTS_WEAKREFS(Py_TYPE(object))) {
|
||||
PyWeakReference **list = GET_WEAKREFS_LISTPTR(object);
|
||||
Py_ssize_t count = _PyWeakref_GetWeakrefCount(*list);
|
||||
|
||||
|
|
|
@ -41,7 +41,7 @@ typedef struct arrayobject {
|
|||
static PyTypeObject Arraytype;
|
||||
|
||||
#define array_Check(op) PyObject_TypeCheck(op, &Arraytype)
|
||||
#define array_CheckExact(op) (Py_Type(op) == &Arraytype)
|
||||
#define array_CheckExact(op) (Py_TYPE(op) == &Arraytype)
|
||||
|
||||
static int
|
||||
array_resize(arrayobject *self, Py_ssize_t newsize)
|
||||
|
@ -55,9 +55,9 @@ array_resize(arrayobject *self, Py_ssize_t newsize)
|
|||
*/
|
||||
|
||||
if (self->allocated >= newsize &&
|
||||
Py_Size(self) < newsize + 16 &&
|
||||
Py_SIZE(self) < newsize + 16 &&
|
||||
self->ob_item != NULL) {
|
||||
Py_Size(self) = newsize;
|
||||
Py_SIZE(self) = newsize;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -79,7 +79,7 @@ array_resize(arrayobject *self, Py_ssize_t newsize)
|
|||
* memory critical.
|
||||
*/
|
||||
|
||||
_new_size = (newsize >> 4) + (Py_Size(self) < 8 ? 3 : 7) + newsize;
|
||||
_new_size = (newsize >> 4) + (Py_SIZE(self) < 8 ? 3 : 7) + newsize;
|
||||
items = self->ob_item;
|
||||
/* XXX The following multiplication and division does not optimize away
|
||||
like it does for lists since the size is not known at compile time */
|
||||
|
@ -92,7 +92,7 @@ array_resize(arrayobject *self, Py_ssize_t newsize)
|
|||
return -1;
|
||||
}
|
||||
self->ob_item = items;
|
||||
Py_Size(self) = newsize;
|
||||
Py_SIZE(self) = newsize;
|
||||
self->allocated = _new_size;
|
||||
return 0;
|
||||
}
|
||||
|
@ -421,7 +421,7 @@ newarrayobject(PyTypeObject *type, Py_ssize_t size, struct arraydescr *descr)
|
|||
if (op == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
Py_Size(op) = size;
|
||||
Py_SIZE(op) = size;
|
||||
if (size <= 0) {
|
||||
op->ob_item = NULL;
|
||||
}
|
||||
|
@ -445,7 +445,7 @@ getarrayitem(PyObject *op, Py_ssize_t i)
|
|||
register arrayobject *ap;
|
||||
assert(array_Check(op));
|
||||
ap = (arrayobject *)op;
|
||||
assert(i>=0 && i<Py_Size(ap));
|
||||
assert(i>=0 && i<Py_SIZE(ap));
|
||||
return (*ap->ob_descr->getitem)(ap, i);
|
||||
}
|
||||
|
||||
|
@ -453,7 +453,7 @@ static int
|
|||
ins1(arrayobject *self, Py_ssize_t where, PyObject *v)
|
||||
{
|
||||
char *items;
|
||||
Py_ssize_t n = Py_Size(self);
|
||||
Py_ssize_t n = Py_SIZE(self);
|
||||
if (v == NULL) {
|
||||
PyErr_BadInternalCall();
|
||||
return -1;
|
||||
|
@ -488,7 +488,7 @@ array_dealloc(arrayobject *op)
|
|||
PyObject_ClearWeakRefs((PyObject *) op);
|
||||
if (op->ob_item != NULL)
|
||||
PyMem_DEL(op->ob_item);
|
||||
Py_Type(op)->tp_free((PyObject *)op);
|
||||
Py_TYPE(op)->tp_free((PyObject *)op);
|
||||
}
|
||||
|
||||
static PyObject *
|
||||
|
@ -508,7 +508,7 @@ array_richcompare(PyObject *v, PyObject *w, int op)
|
|||
va = (arrayobject *)v;
|
||||
wa = (arrayobject *)w;
|
||||
|
||||
if (Py_Size(va) != Py_Size(wa) && (op == Py_EQ || op == Py_NE)) {
|
||||
if (Py_SIZE(va) != Py_SIZE(wa) && (op == Py_EQ || op == Py_NE)) {
|
||||
/* Shortcut: if the lengths differ, the arrays differ */
|
||||
if (op == Py_EQ)
|
||||
res = Py_False;
|
||||
|
@ -520,7 +520,7 @@ array_richcompare(PyObject *v, PyObject *w, int op)
|
|||
|
||||
/* Search for the first index where items are different */
|
||||
k = 1;
|
||||
for (i = 0; i < Py_Size(va) && i < Py_Size(wa); i++) {
|
||||
for (i = 0; i < Py_SIZE(va) && i < Py_SIZE(wa); i++) {
|
||||
vi = getarrayitem(v, i);
|
||||
wi = getarrayitem(w, i);
|
||||
if (vi == NULL || wi == NULL) {
|
||||
|
@ -539,8 +539,8 @@ array_richcompare(PyObject *v, PyObject *w, int op)
|
|||
|
||||
if (k) {
|
||||
/* No more items to compare -- compare sizes */
|
||||
Py_ssize_t vs = Py_Size(va);
|
||||
Py_ssize_t ws = Py_Size(wa);
|
||||
Py_ssize_t vs = Py_SIZE(va);
|
||||
Py_ssize_t ws = Py_SIZE(wa);
|
||||
int cmp;
|
||||
switch (op) {
|
||||
case Py_LT: cmp = vs < ws; break;
|
||||
|
@ -580,13 +580,13 @@ array_richcompare(PyObject *v, PyObject *w, int op)
|
|||
static Py_ssize_t
|
||||
array_length(arrayobject *a)
|
||||
{
|
||||
return Py_Size(a);
|
||||
return Py_SIZE(a);
|
||||
}
|
||||
|
||||
static PyObject *
|
||||
array_item(arrayobject *a, Py_ssize_t i)
|
||||
{
|
||||
if (i < 0 || i >= Py_Size(a)) {
|
||||
if (i < 0 || i >= Py_SIZE(a)) {
|
||||
PyErr_SetString(PyExc_IndexError, "array index out of range");
|
||||
return NULL;
|
||||
}
|
||||
|
@ -599,14 +599,14 @@ array_slice(arrayobject *a, Py_ssize_t ilow, Py_ssize_t ihigh)
|
|||
arrayobject *np;
|
||||
if (ilow < 0)
|
||||
ilow = 0;
|
||||
else if (ilow > Py_Size(a))
|
||||
ilow = Py_Size(a);
|
||||
else if (ilow > Py_SIZE(a))
|
||||
ilow = Py_SIZE(a);
|
||||
if (ihigh < 0)
|
||||
ihigh = 0;
|
||||
if (ihigh < ilow)
|
||||
ihigh = ilow;
|
||||
else if (ihigh > Py_Size(a))
|
||||
ihigh = Py_Size(a);
|
||||
else if (ihigh > Py_SIZE(a))
|
||||
ihigh = Py_SIZE(a);
|
||||
np = (arrayobject *) newarrayobject(&Arraytype, ihigh - ilow, a->ob_descr);
|
||||
if (np == NULL)
|
||||
return NULL;
|
||||
|
@ -618,7 +618,7 @@ array_slice(arrayobject *a, Py_ssize_t ilow, Py_ssize_t ihigh)
|
|||
static PyObject *
|
||||
array_copy(arrayobject *a, PyObject *unused)
|
||||
{
|
||||
return array_slice(a, 0, Py_Size(a));
|
||||
return array_slice(a, 0, Py_SIZE(a));
|
||||
}
|
||||
|
||||
PyDoc_STRVAR(copy_doc,
|
||||
|
@ -634,7 +634,7 @@ array_concat(arrayobject *a, PyObject *bb)
|
|||
if (!array_Check(bb)) {
|
||||
PyErr_Format(PyExc_TypeError,
|
||||
"can only append array (not \"%.200s\") to array",
|
||||
Py_Type(bb)->tp_name);
|
||||
Py_TYPE(bb)->tp_name);
|
||||
return NULL;
|
||||
}
|
||||
#define b ((arrayobject *)bb)
|
||||
|
@ -642,14 +642,14 @@ array_concat(arrayobject *a, PyObject *bb)
|
|||
PyErr_BadArgument();
|
||||
return NULL;
|
||||
}
|
||||
size = Py_Size(a) + Py_Size(b);
|
||||
size = Py_SIZE(a) + Py_SIZE(b);
|
||||
np = (arrayobject *) newarrayobject(&Arraytype, size, a->ob_descr);
|
||||
if (np == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
memcpy(np->ob_item, a->ob_item, Py_Size(a)*a->ob_descr->itemsize);
|
||||
memcpy(np->ob_item + Py_Size(a)*a->ob_descr->itemsize,
|
||||
b->ob_item, Py_Size(b)*b->ob_descr->itemsize);
|
||||
memcpy(np->ob_item, a->ob_item, Py_SIZE(a)*a->ob_descr->itemsize);
|
||||
memcpy(np->ob_item + Py_SIZE(a)*a->ob_descr->itemsize,
|
||||
b->ob_item, Py_SIZE(b)*b->ob_descr->itemsize);
|
||||
return (PyObject *)np;
|
||||
#undef b
|
||||
}
|
||||
|
@ -664,12 +664,12 @@ array_repeat(arrayobject *a, Py_ssize_t n)
|
|||
Py_ssize_t nbytes;
|
||||
if (n < 0)
|
||||
n = 0;
|
||||
size = Py_Size(a) * n;
|
||||
size = Py_SIZE(a) * n;
|
||||
np = (arrayobject *) newarrayobject(&Arraytype, size, a->ob_descr);
|
||||
if (np == NULL)
|
||||
return NULL;
|
||||
p = np->ob_item;
|
||||
nbytes = Py_Size(a) * a->ob_descr->itemsize;
|
||||
nbytes = Py_SIZE(a) * a->ob_descr->itemsize;
|
||||
for (i = 0; i < n; i++) {
|
||||
memcpy(p, a->ob_item, nbytes);
|
||||
p += nbytes;
|
||||
|
@ -687,7 +687,7 @@ array_ass_slice(arrayobject *a, Py_ssize_t ilow, Py_ssize_t ihigh, PyObject *v)
|
|||
if (v == NULL)
|
||||
n = 0;
|
||||
else if (array_Check(v)) {
|
||||
n = Py_Size(b);
|
||||
n = Py_SIZE(b);
|
||||
if (a == b) {
|
||||
/* Special case "a[i:j] = a" -- copy b first */
|
||||
int ret;
|
||||
|
@ -706,44 +706,44 @@ array_ass_slice(arrayobject *a, Py_ssize_t ilow, Py_ssize_t ihigh, PyObject *v)
|
|||
else {
|
||||
PyErr_Format(PyExc_TypeError,
|
||||
"can only assign array (not \"%.200s\") to array slice",
|
||||
Py_Type(v)->tp_name);
|
||||
Py_TYPE(v)->tp_name);
|
||||
return -1;
|
||||
}
|
||||
if (ilow < 0)
|
||||
ilow = 0;
|
||||
else if (ilow > Py_Size(a))
|
||||
ilow = Py_Size(a);
|
||||
else if (ilow > Py_SIZE(a))
|
||||
ilow = Py_SIZE(a);
|
||||
if (ihigh < 0)
|
||||
ihigh = 0;
|
||||
if (ihigh < ilow)
|
||||
ihigh = ilow;
|
||||
else if (ihigh > Py_Size(a))
|
||||
ihigh = Py_Size(a);
|
||||
else if (ihigh > Py_SIZE(a))
|
||||
ihigh = Py_SIZE(a);
|
||||
item = a->ob_item;
|
||||
d = n - (ihigh-ilow);
|
||||
if (d < 0) { /* Delete -d items */
|
||||
memmove(item + (ihigh+d)*a->ob_descr->itemsize,
|
||||
item + ihigh*a->ob_descr->itemsize,
|
||||
(Py_Size(a)-ihigh)*a->ob_descr->itemsize);
|
||||
Py_Size(a) += d;
|
||||
PyMem_RESIZE(item, char, Py_Size(a)*a->ob_descr->itemsize);
|
||||
(Py_SIZE(a)-ihigh)*a->ob_descr->itemsize);
|
||||
Py_SIZE(a) += d;
|
||||
PyMem_RESIZE(item, char, Py_SIZE(a)*a->ob_descr->itemsize);
|
||||
/* Can't fail */
|
||||
a->ob_item = item;
|
||||
a->allocated = Py_Size(a);
|
||||
a->allocated = Py_SIZE(a);
|
||||
}
|
||||
else if (d > 0) { /* Insert d items */
|
||||
PyMem_RESIZE(item, char,
|
||||
(Py_Size(a) + d)*a->ob_descr->itemsize);
|
||||
(Py_SIZE(a) + d)*a->ob_descr->itemsize);
|
||||
if (item == NULL) {
|
||||
PyErr_NoMemory();
|
||||
return -1;
|
||||
}
|
||||
memmove(item + (ihigh+d)*a->ob_descr->itemsize,
|
||||
item + ihigh*a->ob_descr->itemsize,
|
||||
(Py_Size(a)-ihigh)*a->ob_descr->itemsize);
|
||||
(Py_SIZE(a)-ihigh)*a->ob_descr->itemsize);
|
||||
a->ob_item = item;
|
||||
Py_Size(a) += d;
|
||||
a->allocated = Py_Size(a);
|
||||
Py_SIZE(a) += d;
|
||||
a->allocated = Py_SIZE(a);
|
||||
}
|
||||
if (n > 0)
|
||||
memcpy(item + ilow*a->ob_descr->itemsize, b->ob_item,
|
||||
|
@ -755,7 +755,7 @@ array_ass_slice(arrayobject *a, Py_ssize_t ilow, Py_ssize_t ihigh, PyObject *v)
|
|||
static int
|
||||
array_ass_item(arrayobject *a, Py_ssize_t i, PyObject *v)
|
||||
{
|
||||
if (i < 0 || i >= Py_Size(a)) {
|
||||
if (i < 0 || i >= Py_SIZE(a)) {
|
||||
PyErr_SetString(PyExc_IndexError,
|
||||
"array assignment index out of range");
|
||||
return -1;
|
||||
|
@ -782,7 +782,7 @@ array_iter_extend(arrayobject *self, PyObject *bb)
|
|||
return -1;
|
||||
|
||||
while ((v = PyIter_Next(it)) != NULL) {
|
||||
if (ins1(self, (int) Py_Size(self), v) != 0) {
|
||||
if (ins1(self, (int) Py_SIZE(self), v) != 0) {
|
||||
Py_DECREF(v);
|
||||
Py_DECREF(it);
|
||||
return -1;
|
||||
|
@ -808,16 +808,16 @@ array_do_extend(arrayobject *self, PyObject *bb)
|
|||
"can only extend with array of same kind");
|
||||
return -1;
|
||||
}
|
||||
size = Py_Size(self) + Py_Size(b);
|
||||
size = Py_SIZE(self) + Py_SIZE(b);
|
||||
PyMem_RESIZE(self->ob_item, char, size*self->ob_descr->itemsize);
|
||||
if (self->ob_item == NULL) {
|
||||
PyObject_Del(self);
|
||||
PyErr_NoMemory();
|
||||
return -1;
|
||||
}
|
||||
memcpy(self->ob_item + Py_Size(self)*self->ob_descr->itemsize,
|
||||
b->ob_item, Py_Size(b)*b->ob_descr->itemsize);
|
||||
Py_Size(self) = size;
|
||||
memcpy(self->ob_item + Py_SIZE(self)*self->ob_descr->itemsize,
|
||||
b->ob_item, Py_SIZE(b)*b->ob_descr->itemsize);
|
||||
Py_SIZE(self) = size;
|
||||
self->allocated = size;
|
||||
|
||||
return 0;
|
||||
|
@ -830,7 +830,7 @@ array_inplace_concat(arrayobject *self, PyObject *bb)
|
|||
if (!array_Check(bb)) {
|
||||
PyErr_Format(PyExc_TypeError,
|
||||
"can only extend array with array (not \"%.200s\")",
|
||||
Py_Type(bb)->tp_name);
|
||||
Py_TYPE(bb)->tp_name);
|
||||
return NULL;
|
||||
}
|
||||
if (array_do_extend(self, bb) == -1)
|
||||
|
@ -845,15 +845,15 @@ array_inplace_repeat(arrayobject *self, Py_ssize_t n)
|
|||
char *items, *p;
|
||||
Py_ssize_t size, i;
|
||||
|
||||
if (Py_Size(self) > 0) {
|
||||
if (Py_SIZE(self) > 0) {
|
||||
if (n < 0)
|
||||
n = 0;
|
||||
items = self->ob_item;
|
||||
size = Py_Size(self) * self->ob_descr->itemsize;
|
||||
size = Py_SIZE(self) * self->ob_descr->itemsize;
|
||||
if (n == 0) {
|
||||
PyMem_FREE(items);
|
||||
self->ob_item = NULL;
|
||||
Py_Size(self) = 0;
|
||||
Py_SIZE(self) = 0;
|
||||
self->allocated = 0;
|
||||
}
|
||||
else {
|
||||
|
@ -866,8 +866,8 @@ array_inplace_repeat(arrayobject *self, Py_ssize_t n)
|
|||
memcpy(p, items, size);
|
||||
}
|
||||
self->ob_item = items;
|
||||
Py_Size(self) *= n;
|
||||
self->allocated = Py_Size(self);
|
||||
Py_SIZE(self) *= n;
|
||||
self->allocated = Py_SIZE(self);
|
||||
}
|
||||
}
|
||||
Py_INCREF(self);
|
||||
|
@ -890,7 +890,7 @@ array_count(arrayobject *self, PyObject *v)
|
|||
Py_ssize_t count = 0;
|
||||
Py_ssize_t i;
|
||||
|
||||
for (i = 0; i < Py_Size(self); i++) {
|
||||
for (i = 0; i < Py_SIZE(self); i++) {
|
||||
PyObject *selfi = getarrayitem((PyObject *)self, i);
|
||||
int cmp = PyObject_RichCompareBool(selfi, v, Py_EQ);
|
||||
Py_DECREF(selfi);
|
||||
|
@ -912,7 +912,7 @@ array_index(arrayobject *self, PyObject *v)
|
|||
{
|
||||
Py_ssize_t i;
|
||||
|
||||
for (i = 0; i < Py_Size(self); i++) {
|
||||
for (i = 0; i < Py_SIZE(self); i++) {
|
||||
PyObject *selfi = getarrayitem((PyObject *)self, i);
|
||||
int cmp = PyObject_RichCompareBool(selfi, v, Py_EQ);
|
||||
Py_DECREF(selfi);
|
||||
|
@ -937,7 +937,7 @@ array_contains(arrayobject *self, PyObject *v)
|
|||
Py_ssize_t i;
|
||||
int cmp;
|
||||
|
||||
for (i = 0, cmp = 0 ; cmp == 0 && i < Py_Size(self); i++) {
|
||||
for (i = 0, cmp = 0 ; cmp == 0 && i < Py_SIZE(self); i++) {
|
||||
PyObject *selfi = getarrayitem((PyObject *)self, i);
|
||||
cmp = PyObject_RichCompareBool(selfi, v, Py_EQ);
|
||||
Py_DECREF(selfi);
|
||||
|
@ -950,7 +950,7 @@ array_remove(arrayobject *self, PyObject *v)
|
|||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < Py_Size(self); i++) {
|
||||
for (i = 0; i < Py_SIZE(self); i++) {
|
||||
PyObject *selfi = getarrayitem((PyObject *)self,i);
|
||||
int cmp = PyObject_RichCompareBool(selfi, v, Py_EQ);
|
||||
Py_DECREF(selfi);
|
||||
|
@ -980,14 +980,14 @@ array_pop(arrayobject *self, PyObject *args)
|
|||
PyObject *v;
|
||||
if (!PyArg_ParseTuple(args, "|n:pop", &i))
|
||||
return NULL;
|
||||
if (Py_Size(self) == 0) {
|
||||
if (Py_SIZE(self) == 0) {
|
||||
/* Special-case most common failure cause */
|
||||
PyErr_SetString(PyExc_IndexError, "pop from empty array");
|
||||
return NULL;
|
||||
}
|
||||
if (i < 0)
|
||||
i += Py_Size(self);
|
||||
if (i < 0 || i >= Py_Size(self)) {
|
||||
i += Py_SIZE(self);
|
||||
if (i < 0 || i >= Py_SIZE(self)) {
|
||||
PyErr_SetString(PyExc_IndexError, "pop index out of range");
|
||||
return NULL;
|
||||
}
|
||||
|
@ -1043,7 +1043,7 @@ array_buffer_info(arrayobject *self, PyObject *unused)
|
|||
return NULL;
|
||||
|
||||
PyTuple_SET_ITEM(retval, 0, PyLong_FromVoidPtr(self->ob_item));
|
||||
PyTuple_SET_ITEM(retval, 1, PyLong_FromLong((long)(Py_Size(self))));
|
||||
PyTuple_SET_ITEM(retval, 1, PyLong_FromLong((long)(Py_SIZE(self))));
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
@ -1060,7 +1060,7 @@ the buffer length in bytes.");
|
|||
static PyObject *
|
||||
array_append(arrayobject *self, PyObject *v)
|
||||
{
|
||||
return ins(self, (int) Py_Size(self), v);
|
||||
return ins(self, (int) Py_SIZE(self), v);
|
||||
}
|
||||
|
||||
PyDoc_STRVAR(append_doc,
|
||||
|
@ -1079,14 +1079,14 @@ array_byteswap(arrayobject *self, PyObject *unused)
|
|||
case 1:
|
||||
break;
|
||||
case 2:
|
||||
for (p = self->ob_item, i = Py_Size(self); --i >= 0; p += 2) {
|
||||
for (p = self->ob_item, i = Py_SIZE(self); --i >= 0; p += 2) {
|
||||
char p0 = p[0];
|
||||
p[0] = p[1];
|
||||
p[1] = p0;
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
for (p = self->ob_item, i = Py_Size(self); --i >= 0; p += 4) {
|
||||
for (p = self->ob_item, i = Py_SIZE(self); --i >= 0; p += 4) {
|
||||
char p0 = p[0];
|
||||
char p1 = p[1];
|
||||
p[0] = p[3];
|
||||
|
@ -1096,7 +1096,7 @@ array_byteswap(arrayobject *self, PyObject *unused)
|
|||
}
|
||||
break;
|
||||
case 8:
|
||||
for (p = self->ob_item, i = Py_Size(self); --i >= 0; p += 8) {
|
||||
for (p = self->ob_item, i = Py_SIZE(self); --i >= 0; p += 8) {
|
||||
char p0 = p[0];
|
||||
char p1 = p[1];
|
||||
char p2 = p[2];
|
||||
|
@ -1137,16 +1137,16 @@ array_reduce(arrayobject *array)
|
|||
dict = Py_None;
|
||||
Py_INCREF(dict);
|
||||
}
|
||||
if (Py_Size(array) > 0) {
|
||||
if (Py_SIZE(array) > 0) {
|
||||
result = Py_BuildValue("O(cy#)O",
|
||||
Py_Type(array),
|
||||
Py_TYPE(array),
|
||||
array->ob_descr->typecode,
|
||||
array->ob_item,
|
||||
Py_Size(array) * array->ob_descr->itemsize,
|
||||
Py_SIZE(array) * array->ob_descr->itemsize,
|
||||
dict);
|
||||
} else {
|
||||
result = Py_BuildValue("O(c)O",
|
||||
Py_Type(array),
|
||||
Py_TYPE(array),
|
||||
array->ob_descr->typecode,
|
||||
dict);
|
||||
}
|
||||
|
@ -1165,9 +1165,9 @@ array_reverse(arrayobject *self, PyObject *unused)
|
|||
char tmp[256]; /* 8 is probably enough -- but why skimp */
|
||||
assert((size_t)itemsize <= sizeof(tmp));
|
||||
|
||||
if (Py_Size(self) > 1) {
|
||||
if (Py_SIZE(self) > 1) {
|
||||
for (p = self->ob_item,
|
||||
q = self->ob_item + (Py_Size(self) - 1)*itemsize;
|
||||
q = self->ob_item + (Py_SIZE(self) - 1)*itemsize;
|
||||
p < q;
|
||||
p += itemsize, q -= itemsize) {
|
||||
/* memory areas guaranteed disjoint, so memcpy
|
||||
|
@ -1247,14 +1247,14 @@ array. Also called as read.");
|
|||
static PyObject *
|
||||
array_tofile(arrayobject *self, PyObject *f)
|
||||
{
|
||||
Py_ssize_t nbytes = Py_Size(self) * self->ob_descr->itemsize;
|
||||
Py_ssize_t nbytes = Py_SIZE(self) * self->ob_descr->itemsize;
|
||||
/* Write 64K blocks at a time */
|
||||
/* XXX Make the block size settable */
|
||||
int BLOCKSIZE = 64*1024;
|
||||
Py_ssize_t nblocks = (nbytes + BLOCKSIZE - 1) / BLOCKSIZE;
|
||||
Py_ssize_t i;
|
||||
|
||||
if (Py_Size(self) == 0)
|
||||
if (Py_SIZE(self) == 0)
|
||||
goto done;
|
||||
|
||||
for (i = 0; i < nblocks; i++) {
|
||||
|
@ -1299,23 +1299,23 @@ array_fromlist(arrayobject *self, PyObject *list)
|
|||
if (n > 0) {
|
||||
char *item = self->ob_item;
|
||||
Py_ssize_t i;
|
||||
PyMem_RESIZE(item, char, (Py_Size(self) + n) * itemsize);
|
||||
PyMem_RESIZE(item, char, (Py_SIZE(self) + n) * itemsize);
|
||||
if (item == NULL) {
|
||||
PyErr_NoMemory();
|
||||
return NULL;
|
||||
}
|
||||
self->ob_item = item;
|
||||
Py_Size(self) += n;
|
||||
self->allocated = Py_Size(self);
|
||||
Py_SIZE(self) += n;
|
||||
self->allocated = Py_SIZE(self);
|
||||
for (i = 0; i < n; i++) {
|
||||
PyObject *v = PyList_GetItem(list, i);
|
||||
if ((*self->ob_descr->setitem)(self,
|
||||
Py_Size(self) - n + i, v) != 0) {
|
||||
Py_Size(self) -= n;
|
||||
Py_SIZE(self) - n + i, v) != 0) {
|
||||
Py_SIZE(self) -= n;
|
||||
PyMem_RESIZE(item, char,
|
||||
Py_Size(self) * itemsize);
|
||||
Py_SIZE(self) * itemsize);
|
||||
self->ob_item = item;
|
||||
self->allocated = Py_Size(self);
|
||||
self->allocated = Py_SIZE(self);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
@ -1332,12 +1332,12 @@ Append items to array from list.");
|
|||
static PyObject *
|
||||
array_tolist(arrayobject *self, PyObject *unused)
|
||||
{
|
||||
PyObject *list = PyList_New(Py_Size(self));
|
||||
PyObject *list = PyList_New(Py_SIZE(self));
|
||||
Py_ssize_t i;
|
||||
|
||||
if (list == NULL)
|
||||
return NULL;
|
||||
for (i = 0; i < Py_Size(self); i++) {
|
||||
for (i = 0; i < Py_SIZE(self); i++) {
|
||||
PyObject *v = getarrayitem((PyObject *)self, i);
|
||||
if (v == NULL) {
|
||||
Py_DECREF(list);
|
||||
|
@ -1370,15 +1370,15 @@ array_fromstring(arrayobject *self, PyObject *args)
|
|||
n = n / itemsize;
|
||||
if (n > 0) {
|
||||
char *item = self->ob_item;
|
||||
PyMem_RESIZE(item, char, (Py_Size(self) + n) * itemsize);
|
||||
PyMem_RESIZE(item, char, (Py_SIZE(self) + n) * itemsize);
|
||||
if (item == NULL) {
|
||||
PyErr_NoMemory();
|
||||
return NULL;
|
||||
}
|
||||
self->ob_item = item;
|
||||
Py_Size(self) += n;
|
||||
self->allocated = Py_Size(self);
|
||||
memcpy(item + (Py_Size(self) - n) * itemsize,
|
||||
Py_SIZE(self) += n;
|
||||
self->allocated = Py_SIZE(self);
|
||||
memcpy(item + (Py_SIZE(self) - n) * itemsize,
|
||||
str, itemsize*n);
|
||||
}
|
||||
Py_INCREF(Py_None);
|
||||
|
@ -1396,7 +1396,7 @@ static PyObject *
|
|||
array_tostring(arrayobject *self, PyObject *unused)
|
||||
{
|
||||
return PyString_FromStringAndSize(self->ob_item,
|
||||
Py_Size(self) * self->ob_descr->itemsize);
|
||||
Py_SIZE(self) * self->ob_descr->itemsize);
|
||||
}
|
||||
|
||||
PyDoc_STRVAR(tostring_doc,
|
||||
|
@ -1425,15 +1425,15 @@ array_fromunicode(arrayobject *self, PyObject *args)
|
|||
}
|
||||
if (n > 0) {
|
||||
Py_UNICODE *item = (Py_UNICODE *) self->ob_item;
|
||||
PyMem_RESIZE(item, Py_UNICODE, Py_Size(self) + n);
|
||||
PyMem_RESIZE(item, Py_UNICODE, Py_SIZE(self) + n);
|
||||
if (item == NULL) {
|
||||
PyErr_NoMemory();
|
||||
return NULL;
|
||||
}
|
||||
self->ob_item = (char *) item;
|
||||
Py_Size(self) += n;
|
||||
self->allocated = Py_Size(self);
|
||||
memcpy(item + Py_Size(self) - n,
|
||||
Py_SIZE(self) += n;
|
||||
self->allocated = Py_SIZE(self);
|
||||
memcpy(item + Py_SIZE(self) - n,
|
||||
ustr, n * sizeof(Py_UNICODE));
|
||||
}
|
||||
|
||||
|
@ -1460,7 +1460,7 @@ array_tounicode(arrayobject *self, PyObject *unused)
|
|||
"tounicode() may only be called on unicode type arrays");
|
||||
return NULL;
|
||||
}
|
||||
return PyUnicode_FromUnicode((Py_UNICODE *) self->ob_item, Py_Size(self));
|
||||
return PyUnicode_FromUnicode((Py_UNICODE *) self->ob_item, Py_SIZE(self));
|
||||
}
|
||||
|
||||
PyDoc_STRVAR(tounicode_doc,
|
||||
|
@ -1553,7 +1553,7 @@ array_repr(arrayobject *a)
|
|||
PyObject *s, *v = NULL;
|
||||
Py_ssize_t len;
|
||||
|
||||
len = Py_Size(a);
|
||||
len = Py_SIZE(a);
|
||||
typecode = a->ob_descr->typecode;
|
||||
if (len == 0) {
|
||||
return PyUnicode_FromFormat("array('%c')", typecode);
|
||||
|
@ -1577,7 +1577,7 @@ array_subscr(arrayobject* self, PyObject* item)
|
|||
return NULL;
|
||||
}
|
||||
if (i < 0)
|
||||
i += Py_Size(self);
|
||||
i += Py_SIZE(self);
|
||||
return array_item(self, i);
|
||||
}
|
||||
else if (PySlice_Check(item)) {
|
||||
|
@ -1586,7 +1586,7 @@ array_subscr(arrayobject* self, PyObject* item)
|
|||
arrayobject* ar;
|
||||
int itemsize = self->ob_descr->itemsize;
|
||||
|
||||
if (PySlice_GetIndicesEx((PySliceObject*)item, Py_Size(self),
|
||||
if (PySlice_GetIndicesEx((PySliceObject*)item, Py_SIZE(self),
|
||||
&start, &stop, &step, &slicelength) < 0) {
|
||||
return NULL;
|
||||
}
|
||||
|
@ -1640,8 +1640,8 @@ array_ass_subscr(arrayobject* self, PyObject* item, PyObject* value)
|
|||
if (i == -1 && PyErr_Occurred())
|
||||
return -1;
|
||||
if (i < 0)
|
||||
i += Py_Size(self);
|
||||
if (i < 0 || i >= Py_Size(self)) {
|
||||
i += Py_SIZE(self);
|
||||
if (i < 0 || i >= Py_SIZE(self)) {
|
||||
PyErr_SetString(PyExc_IndexError,
|
||||
"array assignment index out of range");
|
||||
return -1;
|
||||
|
@ -1658,7 +1658,7 @@ array_ass_subscr(arrayobject* self, PyObject* item, PyObject* value)
|
|||
}
|
||||
else if (PySlice_Check(item)) {
|
||||
if (PySlice_GetIndicesEx((PySliceObject *)item,
|
||||
Py_Size(self), &start, &stop,
|
||||
Py_SIZE(self), &start, &stop,
|
||||
&step, &slicelength) < 0) {
|
||||
return -1;
|
||||
}
|
||||
|
@ -1674,7 +1674,7 @@ array_ass_subscr(arrayobject* self, PyObject* item, PyObject* value)
|
|||
}
|
||||
else if (array_Check(value)) {
|
||||
other = (arrayobject *)value;
|
||||
needed = Py_Size(other);
|
||||
needed = Py_SIZE(other);
|
||||
if (self == other) {
|
||||
/* Special case "self[i:j] = self" -- copy self first */
|
||||
int ret;
|
||||
|
@ -1693,7 +1693,7 @@ array_ass_subscr(arrayobject* self, PyObject* item, PyObject* value)
|
|||
else {
|
||||
PyErr_Format(PyExc_TypeError,
|
||||
"can only assign array (not \"%.200s\") to array slice",
|
||||
Py_Type(value)->tp_name);
|
||||
Py_TYPE(value)->tp_name);
|
||||
return -1;
|
||||
}
|
||||
itemsize = self->ob_descr->itemsize;
|
||||
|
@ -1705,18 +1705,18 @@ array_ass_subscr(arrayobject* self, PyObject* item, PyObject* value)
|
|||
if (slicelength > needed) {
|
||||
memmove(self->ob_item + (start + needed) * itemsize,
|
||||
self->ob_item + stop * itemsize,
|
||||
(Py_Size(self) - stop) * itemsize);
|
||||
if (array_resize(self, Py_Size(self) +
|
||||
(Py_SIZE(self) - stop) * itemsize);
|
||||
if (array_resize(self, Py_SIZE(self) +
|
||||
needed - slicelength) < 0)
|
||||
return -1;
|
||||
}
|
||||
else if (slicelength < needed) {
|
||||
if (array_resize(self, Py_Size(self) +
|
||||
if (array_resize(self, Py_SIZE(self) +
|
||||
needed - slicelength) < 0)
|
||||
return -1;
|
||||
memmove(self->ob_item + (start + needed) * itemsize,
|
||||
self->ob_item + stop * itemsize,
|
||||
(Py_Size(self) - start - needed) * itemsize);
|
||||
(Py_SIZE(self) - start - needed) * itemsize);
|
||||
}
|
||||
if (needed > 0)
|
||||
memcpy(self->ob_item + start * itemsize,
|
||||
|
@ -1736,19 +1736,19 @@ array_ass_subscr(arrayobject* self, PyObject* item, PyObject* value)
|
|||
cur += step, i++) {
|
||||
Py_ssize_t lim = step - 1;
|
||||
|
||||
if (cur + step >= Py_Size(self))
|
||||
lim = Py_Size(self) - cur - 1;
|
||||
if (cur + step >= Py_SIZE(self))
|
||||
lim = Py_SIZE(self) - cur - 1;
|
||||
memmove(self->ob_item + (cur - i) * itemsize,
|
||||
self->ob_item + (cur + 1) * itemsize,
|
||||
lim * itemsize);
|
||||
}
|
||||
cur = start + slicelength * step;
|
||||
if (cur < Py_Size(self)) {
|
||||
if (cur < Py_SIZE(self)) {
|
||||
memmove(self->ob_item + (cur-slicelength) * itemsize,
|
||||
self->ob_item + cur * itemsize,
|
||||
(Py_Size(self) - cur) * itemsize);
|
||||
(Py_SIZE(self) - cur) * itemsize);
|
||||
}
|
||||
if (array_resize(self, Py_Size(self) - slicelength) < 0)
|
||||
if (array_resize(self, Py_SIZE(self) - slicelength) < 0)
|
||||
return -1;
|
||||
return 0;
|
||||
}
|
||||
|
@ -1794,14 +1794,14 @@ array_buffer_getbuf(arrayobject *self, Py_buffer *view, int flags)
|
|||
view->buf = (void *)self->ob_item;
|
||||
if (view->buf == NULL)
|
||||
view->buf = (void *)emptybuf;
|
||||
view->len = (Py_Size(self)) * self->ob_descr->itemsize;
|
||||
view->len = (Py_SIZE(self)) * self->ob_descr->itemsize;
|
||||
view->readonly = 0;
|
||||
view->ndim = 1;
|
||||
view->itemsize = self->ob_descr->itemsize;
|
||||
view->suboffsets = NULL;
|
||||
view->shape = NULL;
|
||||
if ((flags & PyBUF_ND)==PyBUF_ND) {
|
||||
view->shape = &((Py_Size(self)));
|
||||
view->shape = &((Py_SIZE(self)));
|
||||
}
|
||||
view->strides = NULL;
|
||||
if ((flags & PyBUF_STRIDES)==PyBUF_STRIDES)
|
||||
|
@ -1935,9 +1935,9 @@ array_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
|
|||
return NULL;
|
||||
}
|
||||
self->ob_item = item;
|
||||
Py_Size(self) = n / sizeof(Py_UNICODE);
|
||||
Py_SIZE(self) = n / sizeof(Py_UNICODE);
|
||||
memcpy(item, PyUnicode_AS_DATA(initial), n);
|
||||
self->allocated = Py_Size(self);
|
||||
self->allocated = Py_SIZE(self);
|
||||
}
|
||||
}
|
||||
if (it != NULL) {
|
||||
|
@ -2108,7 +2108,7 @@ static PyObject *
|
|||
arrayiter_next(arrayiterobject *it)
|
||||
{
|
||||
assert(PyArrayIter_Check(it));
|
||||
if (it->index < Py_Size(it->ao))
|
||||
if (it->index < Py_SIZE(it->ao))
|
||||
return (*it->getitem)(it->ao, it->index++);
|
||||
return NULL;
|
||||
}
|
||||
|
@ -2180,7 +2180,7 @@ initarray(void)
|
|||
|
||||
if (PyType_Ready(&Arraytype) < 0)
|
||||
return;
|
||||
Py_Type(&PyArrayIter_Type) = &PyType_Type;
|
||||
Py_TYPE(&PyArrayIter_Type) = &PyType_Type;
|
||||
m = Py_InitModule3("array", a_methods, module_doc);
|
||||
if (m == NULL)
|
||||
return;
|
||||
|
|
|
@ -41,7 +41,7 @@ typedef fpos_t Py_off_t;
|
|||
#define MODE_READ_EOF 2
|
||||
#define MODE_WRITE 3
|
||||
|
||||
#define BZ2FileObject_Check(v) (Py_Type(v) == &BZ2File_Type)
|
||||
#define BZ2FileObject_Check(v) (Py_TYPE(v) == &BZ2File_Type)
|
||||
|
||||
|
||||
#ifdef BZ_CONFIG_ERROR
|
||||
|
@ -1240,7 +1240,7 @@ BZ2File_dealloc(BZ2FileObject *self)
|
|||
Util_DropReadAhead(self);
|
||||
if (self->rawfp != NULL)
|
||||
fclose(self->rawfp);
|
||||
Py_Type(self)->tp_free((PyObject *)self);
|
||||
Py_TYPE(self)->tp_free((PyObject *)self);
|
||||
}
|
||||
|
||||
/* This is a hacked version of Python's fileobject.c:file_getiter(). */
|
||||
|
@ -1552,7 +1552,7 @@ BZ2Comp_dealloc(BZ2CompObject *self)
|
|||
PyThread_free_lock(self->lock);
|
||||
#endif
|
||||
BZ2_bzCompressEnd(&self->bzs);
|
||||
Py_Type(self)->tp_free((PyObject *)self);
|
||||
Py_TYPE(self)->tp_free((PyObject *)self);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1777,7 +1777,7 @@ BZ2Decomp_dealloc(BZ2DecompObject *self)
|
|||
#endif
|
||||
Py_XDECREF(self->unused_data);
|
||||
BZ2_bzDecompressEnd(&self->bzs);
|
||||
Py_Type(self)->tp_free((PyObject *)self);
|
||||
Py_TYPE(self)->tp_free((PyObject *)self);
|
||||
}
|
||||
|
||||
|
||||
|
@ -2031,9 +2031,9 @@ initbz2(void)
|
|||
{
|
||||
PyObject *m;
|
||||
|
||||
Py_Type(&BZ2File_Type) = &PyType_Type;
|
||||
Py_Type(&BZ2Comp_Type) = &PyType_Type;
|
||||
Py_Type(&BZ2Decomp_Type) = &PyType_Type;
|
||||
Py_TYPE(&BZ2File_Type) = &PyType_Type;
|
||||
Py_TYPE(&BZ2Comp_Type) = &PyType_Type;
|
||||
Py_TYPE(&BZ2Decomp_Type) = &PyType_Type;
|
||||
|
||||
m = Py_InitModule3("bz2", bz2_methods, bz2__doc__);
|
||||
if (m == NULL)
|
||||
|
|
|
@ -738,8 +738,8 @@ initcStringIO(void) {
|
|||
d = PyModule_GetDict(m);
|
||||
|
||||
/* Export C API */
|
||||
Py_Type(&Itype)=&PyType_Type;
|
||||
Py_Type(&Otype)=&PyType_Type;
|
||||
Py_TYPE(&Itype)=&PyType_Type;
|
||||
Py_TYPE(&Otype)=&PyType_Type;
|
||||
if (PyType_Ready(&Otype) < 0) return;
|
||||
if (PyType_Ready(&Itype) < 0) return;
|
||||
PyDict_SetItemString(d,"cStringIO_CAPI",
|
||||
|
|
|
@ -953,7 +953,7 @@ mbiencoder_dealloc(MultibyteIncrementalEncoderObject *self)
|
|||
{
|
||||
PyObject_GC_UnTrack(self);
|
||||
ERROR_DECREF(self->errors);
|
||||
Py_Type(self)->tp_free(self);
|
||||
Py_TYPE(self)->tp_free(self);
|
||||
}
|
||||
|
||||
static PyTypeObject MultibyteIncrementalEncoder_Type = {
|
||||
|
@ -1153,7 +1153,7 @@ mbidecoder_dealloc(MultibyteIncrementalDecoderObject *self)
|
|||
{
|
||||
PyObject_GC_UnTrack(self);
|
||||
ERROR_DECREF(self->errors);
|
||||
Py_Type(self)->tp_free(self);
|
||||
Py_TYPE(self)->tp_free(self);
|
||||
}
|
||||
|
||||
static PyTypeObject MultibyteIncrementalDecoder_Type = {
|
||||
|
@ -1479,7 +1479,7 @@ mbstreamreader_dealloc(MultibyteStreamReaderObject *self)
|
|||
PyObject_GC_UnTrack(self);
|
||||
ERROR_DECREF(self->errors);
|
||||
Py_DECREF(self->stream);
|
||||
Py_Type(self)->tp_free(self);
|
||||
Py_TYPE(self)->tp_free(self);
|
||||
}
|
||||
|
||||
static PyTypeObject MultibyteStreamReader_Type = {
|
||||
|
@ -1682,7 +1682,7 @@ mbstreamwriter_dealloc(MultibyteStreamWriterObject *self)
|
|||
PyObject_GC_UnTrack(self);
|
||||
ERROR_DECREF(self->errors);
|
||||
Py_DECREF(self->stream);
|
||||
Py_Type(self)->tp_free(self);
|
||||
Py_TYPE(self)->tp_free(self);
|
||||
}
|
||||
|
||||
static struct PyMethodDef mbstreamwriter_methods[] = {
|
||||
|
|
|
@ -764,7 +764,7 @@ check_tzinfo_subclass(PyObject *p)
|
|||
PyErr_Format(PyExc_TypeError,
|
||||
"tzinfo argument must be None or of a tzinfo subclass, "
|
||||
"not type '%s'",
|
||||
Py_Type(p)->tp_name);
|
||||
Py_TYPE(p)->tp_name);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -855,7 +855,7 @@ call_utc_tzinfo_method(PyObject *tzinfo, char *name, PyObject *tzinfoarg,
|
|||
PyErr_Format(PyExc_TypeError,
|
||||
"tzinfo.%s() must return None or "
|
||||
"timedelta, not '%s'",
|
||||
name, Py_Type(u)->tp_name);
|
||||
name, Py_TYPE(u)->tp_name);
|
||||
}
|
||||
|
||||
Py_DECREF(u);
|
||||
|
@ -950,7 +950,7 @@ call_tzname(PyObject *tzinfo, PyObject *tzinfoarg)
|
|||
if (!PyUnicode_Check(result)) {
|
||||
PyErr_Format(PyExc_TypeError, "tzinfo.tzname() must "
|
||||
"return None or a string, not '%s'",
|
||||
Py_Type(result)->tp_name);
|
||||
Py_TYPE(result)->tp_name);
|
||||
Py_DECREF(result);
|
||||
result = NULL;
|
||||
}
|
||||
|
@ -1293,7 +1293,7 @@ wrap_strftime(PyObject *object, PyObject *format, PyObject *timetuple,
|
|||
assert(PyUnicode_Check(Zreplacement));
|
||||
ptoappend = PyUnicode_AsStringAndSize(Zreplacement,
|
||||
&ntoappend);
|
||||
ntoappend = Py_Size(Zreplacement);
|
||||
ntoappend = Py_SIZE(Zreplacement);
|
||||
}
|
||||
else {
|
||||
/* percent followed by neither z nor Z */
|
||||
|
@ -1425,7 +1425,7 @@ cmperror(PyObject *a, PyObject *b)
|
|||
{
|
||||
PyErr_Format(PyExc_TypeError,
|
||||
"can't compare %s to %s",
|
||||
Py_Type(a)->tp_name, Py_Type(b)->tp_name);
|
||||
Py_TYPE(a)->tp_name, Py_TYPE(b)->tp_name);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -1869,7 +1869,7 @@ accum(const char* tag, PyObject *sofar, PyObject *num, PyObject *factor,
|
|||
|
||||
PyErr_Format(PyExc_TypeError,
|
||||
"unsupported type for timedelta %s component: %s",
|
||||
tag, Py_Type(num)->tp_name);
|
||||
tag, Py_TYPE(num)->tp_name);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -1973,18 +1973,18 @@ delta_repr(PyDateTime_Delta *self)
|
|||
{
|
||||
if (GET_TD_MICROSECONDS(self) != 0)
|
||||
return PyUnicode_FromFormat("%s(%d, %d, %d)",
|
||||
Py_Type(self)->tp_name,
|
||||
Py_TYPE(self)->tp_name,
|
||||
GET_TD_DAYS(self),
|
||||
GET_TD_SECONDS(self),
|
||||
GET_TD_MICROSECONDS(self));
|
||||
if (GET_TD_SECONDS(self) != 0)
|
||||
return PyUnicode_FromFormat("%s(%d, %d)",
|
||||
Py_Type(self)->tp_name,
|
||||
Py_TYPE(self)->tp_name,
|
||||
GET_TD_DAYS(self),
|
||||
GET_TD_SECONDS(self));
|
||||
|
||||
return PyUnicode_FromFormat("%s(%d)",
|
||||
Py_Type(self)->tp_name,
|
||||
Py_TYPE(self)->tp_name,
|
||||
GET_TD_DAYS(self));
|
||||
}
|
||||
|
||||
|
@ -2031,7 +2031,7 @@ delta_getstate(PyDateTime_Delta *self)
|
|||
static PyObject *
|
||||
delta_reduce(PyDateTime_Delta* self)
|
||||
{
|
||||
return Py_BuildValue("ON", Py_Type(self), delta_getstate(self));
|
||||
return Py_BuildValue("ON", Py_TYPE(self), delta_getstate(self));
|
||||
}
|
||||
|
||||
#define OFFSET(field) offsetof(PyDateTime_Delta, field)
|
||||
|
@ -2385,7 +2385,7 @@ static PyObject *
|
|||
date_repr(PyDateTime_Date *self)
|
||||
{
|
||||
return PyUnicode_FromFormat("%s(%d, %d, %d)",
|
||||
Py_Type(self)->tp_name,
|
||||
Py_TYPE(self)->tp_name,
|
||||
GET_YEAR(self), GET_MONTH(self), GET_DAY(self));
|
||||
}
|
||||
|
||||
|
@ -2522,7 +2522,7 @@ date_replace(PyDateTime_Date *self, PyObject *args, PyObject *kw)
|
|||
tuple = Py_BuildValue("iii", year, month, day);
|
||||
if (tuple == NULL)
|
||||
return NULL;
|
||||
clone = date_new(Py_Type(self), tuple, NULL);
|
||||
clone = date_new(Py_TYPE(self), tuple, NULL);
|
||||
Py_DECREF(tuple);
|
||||
return clone;
|
||||
}
|
||||
|
@ -2590,7 +2590,7 @@ date_getstate(PyDateTime_Date *self)
|
|||
static PyObject *
|
||||
date_reduce(PyDateTime_Date *self, PyObject *arg)
|
||||
{
|
||||
return Py_BuildValue("(ON)", Py_Type(self), date_getstate(self));
|
||||
return Py_BuildValue("(ON)", Py_TYPE(self), date_getstate(self));
|
||||
}
|
||||
|
||||
static PyMethodDef date_methods[] = {
|
||||
|
@ -2893,10 +2893,10 @@ tzinfo_reduce(PyObject *self)
|
|||
|
||||
if (state == Py_None) {
|
||||
Py_DECREF(state);
|
||||
return Py_BuildValue("(ON)", Py_Type(self), args);
|
||||
return Py_BuildValue("(ON)", Py_TYPE(self), args);
|
||||
}
|
||||
else
|
||||
return Py_BuildValue("(ONN)", Py_Type(self), args, state);
|
||||
return Py_BuildValue("(ONN)", Py_TYPE(self), args, state);
|
||||
}
|
||||
|
||||
static PyMethodDef tzinfo_methods[] = {
|
||||
|
@ -3089,7 +3089,7 @@ time_dealloc(PyDateTime_Time *self)
|
|||
if (HASTZINFO(self)) {
|
||||
Py_XDECREF(self->tzinfo);
|
||||
}
|
||||
Py_Type(self)->tp_free((PyObject *)self);
|
||||
Py_TYPE(self)->tp_free((PyObject *)self);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -3122,7 +3122,7 @@ time_tzname(PyDateTime_Time *self, PyObject *unused) {
|
|||
static PyObject *
|
||||
time_repr(PyDateTime_Time *self)
|
||||
{
|
||||
const char *type_name = Py_Type(self)->tp_name;
|
||||
const char *type_name = Py_TYPE(self)->tp_name;
|
||||
int h = TIME_GET_HOUR(self);
|
||||
int m = TIME_GET_MINUTE(self);
|
||||
int s = TIME_GET_SECOND(self);
|
||||
|
@ -3346,7 +3346,7 @@ time_replace(PyDateTime_Time *self, PyObject *args, PyObject *kw)
|
|||
tuple = Py_BuildValue("iiiiO", hh, mm, ss, us, tzinfo);
|
||||
if (tuple == NULL)
|
||||
return NULL;
|
||||
clone = time_new(Py_Type(self), tuple, NULL);
|
||||
clone = time_new(Py_TYPE(self), tuple, NULL);
|
||||
Py_DECREF(tuple);
|
||||
return clone;
|
||||
}
|
||||
|
@ -3400,7 +3400,7 @@ time_getstate(PyDateTime_Time *self)
|
|||
static PyObject *
|
||||
time_reduce(PyDateTime_Time *self, PyObject *arg)
|
||||
{
|
||||
return Py_BuildValue("(ON)", Py_Type(self), time_getstate(self));
|
||||
return Py_BuildValue("(ON)", Py_TYPE(self), time_getstate(self));
|
||||
}
|
||||
|
||||
static PyMethodDef time_methods[] = {
|
||||
|
@ -3897,7 +3897,7 @@ datetime_dealloc(PyDateTime_DateTime *self)
|
|||
if (HASTZINFO(self)) {
|
||||
Py_XDECREF(self->tzinfo);
|
||||
}
|
||||
Py_Type(self)->tp_free((PyObject *)self);
|
||||
Py_TYPE(self)->tp_free((PyObject *)self);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -4045,7 +4045,7 @@ datetime_subtract(PyObject *left, PyObject *right)
|
|||
static PyObject *
|
||||
datetime_repr(PyDateTime_DateTime *self)
|
||||
{
|
||||
const char *type_name = Py_Type(self)->tp_name;
|
||||
const char *type_name = Py_TYPE(self)->tp_name;
|
||||
PyObject *baserepr;
|
||||
|
||||
if (DATE_GET_MICROSECOND(self)) {
|
||||
|
@ -4262,7 +4262,7 @@ datetime_replace(PyDateTime_DateTime *self, PyObject *args, PyObject *kw)
|
|||
tuple = Py_BuildValue("iiiiiiiO", y, m, d, hh, mm, ss, us, tzinfo);
|
||||
if (tuple == NULL)
|
||||
return NULL;
|
||||
clone = datetime_new(Py_Type(self), tuple, NULL);
|
||||
clone = datetime_new(Py_TYPE(self), tuple, NULL);
|
||||
Py_DECREF(tuple);
|
||||
return clone;
|
||||
}
|
||||
|
@ -4450,7 +4450,7 @@ datetime_getstate(PyDateTime_DateTime *self)
|
|||
static PyObject *
|
||||
datetime_reduce(PyDateTime_DateTime *self, PyObject *arg)
|
||||
{
|
||||
return Py_BuildValue("(ON)", Py_Type(self), datetime_getstate(self));
|
||||
return Py_BuildValue("(ON)", Py_TYPE(self), datetime_getstate(self));
|
||||
}
|
||||
|
||||
static PyMethodDef datetime_methods[] = {
|
||||
|
|
|
@ -36,7 +36,7 @@ typedef struct {
|
|||
|
||||
static PyTypeObject Dbmtype;
|
||||
|
||||
#define is_dbmobject(v) (Py_Type(v) == &Dbmtype)
|
||||
#define is_dbmobject(v) (Py_TYPE(v) == &Dbmtype)
|
||||
#define check_dbmobject_open(v) if ((v)->di_dbm == NULL) \
|
||||
{ PyErr_SetString(DbmError, "DBM object has already been closed"); \
|
||||
return NULL; }
|
||||
|
|
|
@ -62,7 +62,7 @@ dl_sym(dlobject *xp, PyObject *args)
|
|||
name = PyUnicode_AsString(args);
|
||||
} else {
|
||||
PyErr_Format(PyExc_TypeError, "expected string, found %.200s",
|
||||
Py_Type(args)->tp_name);
|
||||
Py_TYPE(args)->tp_name);
|
||||
return NULL;
|
||||
}
|
||||
func = dlsym(xp->dl_handle, name);
|
||||
|
@ -238,7 +238,7 @@ initdl(void)
|
|||
PyObject *m, *d, *x;
|
||||
|
||||
/* Initialize object type */
|
||||
Py_Type(&Dltype) = &PyType_Type;
|
||||
Py_TYPE(&Dltype) = &PyType_Type;
|
||||
|
||||
/* Create the module and add the functions */
|
||||
m = Py_InitModule("dl", dl_methods);
|
||||
|
|
|
@ -235,7 +235,7 @@ update_refs(PyGC_Head *containers)
|
|||
PyGC_Head *gc = containers->gc.gc_next;
|
||||
for (; gc != containers; gc = gc->gc.gc_next) {
|
||||
assert(gc->gc.gc_refs == GC_REACHABLE);
|
||||
gc->gc.gc_refs = Py_Refcnt(FROM_GC(gc));
|
||||
gc->gc.gc_refs = Py_REFCNT(FROM_GC(gc));
|
||||
/* Python's cyclic gc should never see an incoming refcount
|
||||
* of 0: if something decref'ed to 0, it should have been
|
||||
* deallocated immediately at that time.
|
||||
|
@ -287,7 +287,7 @@ subtract_refs(PyGC_Head *containers)
|
|||
traverseproc traverse;
|
||||
PyGC_Head *gc = containers->gc.gc_next;
|
||||
for (; gc != containers; gc=gc->gc.gc_next) {
|
||||
traverse = Py_Type(FROM_GC(gc))->tp_traverse;
|
||||
traverse = Py_TYPE(FROM_GC(gc))->tp_traverse;
|
||||
(void) traverse(FROM_GC(gc),
|
||||
(visitproc)visit_decref,
|
||||
NULL);
|
||||
|
@ -372,7 +372,7 @@ move_unreachable(PyGC_Head *young, PyGC_Head *unreachable)
|
|||
* the next object to visit.
|
||||
*/
|
||||
PyObject *op = FROM_GC(gc);
|
||||
traverseproc traverse = Py_Type(op)->tp_traverse;
|
||||
traverseproc traverse = Py_TYPE(op)->tp_traverse;
|
||||
assert(gc->gc.gc_refs > 0);
|
||||
gc->gc.gc_refs = GC_REACHABLE;
|
||||
(void) traverse(op,
|
||||
|
@ -456,7 +456,7 @@ move_finalizer_reachable(PyGC_Head *finalizers)
|
|||
PyGC_Head *gc = finalizers->gc.gc_next;
|
||||
for (; gc != finalizers; gc = gc->gc.gc_next) {
|
||||
/* Note that the finalizers list may grow during this. */
|
||||
traverse = Py_Type(FROM_GC(gc))->tp_traverse;
|
||||
traverse = Py_TYPE(FROM_GC(gc))->tp_traverse;
|
||||
(void) traverse(FROM_GC(gc),
|
||||
(visitproc)visit_move,
|
||||
(void *)finalizers);
|
||||
|
@ -501,7 +501,7 @@ handle_weakrefs(PyGC_Head *unreachable, PyGC_Head *old)
|
|||
assert(IS_TENTATIVELY_UNREACHABLE(op));
|
||||
next = gc->gc.gc_next;
|
||||
|
||||
if (! PyType_SUPPORTS_WEAKREFS(Py_Type(op)))
|
||||
if (! PyType_SUPPORTS_WEAKREFS(Py_TYPE(op)))
|
||||
continue;
|
||||
|
||||
/* It supports weakrefs. Does it have any? */
|
||||
|
@ -620,7 +620,7 @@ static void
|
|||
debug_cycle(char *msg, PyObject *op)
|
||||
{
|
||||
PySys_WriteStderr("gc: %.100s <%.100s %p>\n",
|
||||
msg, Py_Type(op)->tp_name, op);
|
||||
msg, Py_TYPE(op)->tp_name, op);
|
||||
}
|
||||
|
||||
/* Handle uncollectable garbage (cycles with finalizers, and stuff reachable
|
||||
|
@ -673,7 +673,7 @@ delete_garbage(PyGC_Head *collectable, PyGC_Head *old)
|
|||
PyList_Append(garbage, op);
|
||||
}
|
||||
else {
|
||||
if ((clear = Py_Type(op)->tp_clear) != NULL) {
|
||||
if ((clear = Py_TYPE(op)->tp_clear) != NULL) {
|
||||
Py_INCREF(op);
|
||||
clear(op);
|
||||
Py_DECREF(op);
|
||||
|
@ -1042,7 +1042,7 @@ gc_referrers_for(PyObject *objs, PyGC_Head *list, PyObject *resultlist)
|
|||
traverseproc traverse;
|
||||
for (gc = list->gc.gc_next; gc != list; gc = gc->gc.gc_next) {
|
||||
obj = FROM_GC(gc);
|
||||
traverse = Py_Type(obj)->tp_traverse;
|
||||
traverse = Py_TYPE(obj)->tp_traverse;
|
||||
if (obj == objs || obj == resultlist)
|
||||
continue;
|
||||
if (traverse(obj, (visitproc)referrersvisit, objs)) {
|
||||
|
@ -1099,7 +1099,7 @@ gc_get_referents(PyObject *self, PyObject *args)
|
|||
|
||||
if (! PyObject_IS_GC(obj))
|
||||
continue;
|
||||
traverse = Py_Type(obj)->tp_traverse;
|
||||
traverse = Py_TYPE(obj)->tp_traverse;
|
||||
if (! traverse)
|
||||
continue;
|
||||
if (traverse(obj, (visitproc)referentsvisit, result)) {
|
||||
|
@ -1320,13 +1320,13 @@ _PyObject_GC_NewVar(PyTypeObject *tp, Py_ssize_t nitems)
|
|||
PyVarObject *
|
||||
_PyObject_GC_Resize(PyVarObject *op, Py_ssize_t nitems)
|
||||
{
|
||||
const size_t basicsize = _PyObject_VAR_SIZE(Py_Type(op), nitems);
|
||||
const size_t basicsize = _PyObject_VAR_SIZE(Py_TYPE(op), nitems);
|
||||
PyGC_Head *g = AS_GC(op);
|
||||
g = (PyGC_Head *)PyObject_REALLOC(g, sizeof(PyGC_Head) + basicsize);
|
||||
if (g == NULL)
|
||||
return (PyVarObject *)PyErr_NoMemory();
|
||||
op = (PyVarObject *) FROM_GC(g);
|
||||
Py_Size(op) = nitems;
|
||||
Py_SIZE(op) = nitems;
|
||||
return op;
|
||||
}
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@ typedef struct {
|
|||
|
||||
static PyTypeObject Dbmtype;
|
||||
|
||||
#define is_dbmobject(v) (Py_Type(v) == &Dbmtype)
|
||||
#define is_dbmobject(v) (Py_TYPE(v) == &Dbmtype)
|
||||
#define check_dbmobject_open(v) if ((v)->di_dbm == NULL) \
|
||||
{ PyErr_SetString(DbmError, "GDBM object has already been closed"); \
|
||||
return NULL; }
|
||||
|
|
|
@ -59,7 +59,7 @@ groupby_dealloc(groupbyobject *gbo)
|
|||
Py_XDECREF(gbo->tgtkey);
|
||||
Py_XDECREF(gbo->currkey);
|
||||
Py_XDECREF(gbo->currvalue);
|
||||
Py_Type(gbo)->tp_free(gbo);
|
||||
Py_TYPE(gbo)->tp_free(gbo);
|
||||
}
|
||||
|
||||
static int
|
||||
|
@ -714,7 +714,7 @@ cycle_dealloc(cycleobject *lz)
|
|||
PyObject_GC_UnTrack(lz);
|
||||
Py_XDECREF(lz->saved);
|
||||
Py_XDECREF(lz->it);
|
||||
Py_Type(lz)->tp_free(lz);
|
||||
Py_TYPE(lz)->tp_free(lz);
|
||||
}
|
||||
|
||||
static int
|
||||
|
@ -857,7 +857,7 @@ dropwhile_dealloc(dropwhileobject *lz)
|
|||
PyObject_GC_UnTrack(lz);
|
||||
Py_XDECREF(lz->func);
|
||||
Py_XDECREF(lz->it);
|
||||
Py_Type(lz)->tp_free(lz);
|
||||
Py_TYPE(lz)->tp_free(lz);
|
||||
}
|
||||
|
||||
static int
|
||||
|
@ -877,7 +877,7 @@ dropwhile_next(dropwhileobject *lz)
|
|||
PyObject *(*iternext)(PyObject *);
|
||||
|
||||
assert(PyIter_Check(it));
|
||||
iternext = *Py_Type(it)->tp_iternext;
|
||||
iternext = *Py_TYPE(it)->tp_iternext;
|
||||
for (;;) {
|
||||
item = iternext(it);
|
||||
if (item == NULL)
|
||||
|
@ -1000,7 +1000,7 @@ takewhile_dealloc(takewhileobject *lz)
|
|||
PyObject_GC_UnTrack(lz);
|
||||
Py_XDECREF(lz->func);
|
||||
Py_XDECREF(lz->it);
|
||||
Py_Type(lz)->tp_free(lz);
|
||||
Py_TYPE(lz)->tp_free(lz);
|
||||
}
|
||||
|
||||
static int
|
||||
|
@ -1022,7 +1022,7 @@ takewhile_next(takewhileobject *lz)
|
|||
return NULL;
|
||||
|
||||
assert(PyIter_Check(it));
|
||||
item = (*Py_Type(it)->tp_iternext)(it);
|
||||
item = (*Py_TYPE(it)->tp_iternext)(it);
|
||||
if (item == NULL)
|
||||
return NULL;
|
||||
|
||||
|
@ -1190,7 +1190,7 @@ islice_dealloc(isliceobject *lz)
|
|||
{
|
||||
PyObject_GC_UnTrack(lz);
|
||||
Py_XDECREF(lz->it);
|
||||
Py_Type(lz)->tp_free(lz);
|
||||
Py_TYPE(lz)->tp_free(lz);
|
||||
}
|
||||
|
||||
static int
|
||||
|
@ -1209,7 +1209,7 @@ islice_next(isliceobject *lz)
|
|||
PyObject *(*iternext)(PyObject *);
|
||||
|
||||
assert(PyIter_Check(it));
|
||||
iternext = *Py_Type(it)->tp_iternext;
|
||||
iternext = *Py_TYPE(it)->tp_iternext;
|
||||
while (lz->cnt < lz->next) {
|
||||
item = iternext(it);
|
||||
if (item == NULL)
|
||||
|
@ -1333,7 +1333,7 @@ starmap_dealloc(starmapobject *lz)
|
|||
PyObject_GC_UnTrack(lz);
|
||||
Py_XDECREF(lz->func);
|
||||
Py_XDECREF(lz->it);
|
||||
Py_Type(lz)->tp_free(lz);
|
||||
Py_TYPE(lz)->tp_free(lz);
|
||||
}
|
||||
|
||||
static int
|
||||
|
@ -1352,7 +1352,7 @@ starmap_next(starmapobject *lz)
|
|||
PyObject *it = lz->it;
|
||||
|
||||
assert(PyIter_Check(it));
|
||||
args = (*Py_Type(it)->tp_iternext)(it);
|
||||
args = (*Py_TYPE(it)->tp_iternext)(it);
|
||||
if (args == NULL)
|
||||
return NULL;
|
||||
if (!PyTuple_CheckExact(args)) {
|
||||
|
@ -1478,7 +1478,7 @@ imap_dealloc(imapobject *lz)
|
|||
PyObject_GC_UnTrack(lz);
|
||||
Py_XDECREF(lz->iters);
|
||||
Py_XDECREF(lz->func);
|
||||
Py_Type(lz)->tp_free(lz);
|
||||
Py_TYPE(lz)->tp_free(lz);
|
||||
}
|
||||
|
||||
static int
|
||||
|
@ -1656,7 +1656,7 @@ chain_dealloc(chainobject *lz)
|
|||
{
|
||||
PyObject_GC_UnTrack(lz);
|
||||
Py_XDECREF(lz->ittuple);
|
||||
Py_Type(lz)->tp_free(lz);
|
||||
Py_TYPE(lz)->tp_free(lz);
|
||||
}
|
||||
|
||||
static int
|
||||
|
@ -1787,7 +1787,7 @@ ifilter_dealloc(ifilterobject *lz)
|
|||
PyObject_GC_UnTrack(lz);
|
||||
Py_XDECREF(lz->func);
|
||||
Py_XDECREF(lz->it);
|
||||
Py_Type(lz)->tp_free(lz);
|
||||
Py_TYPE(lz)->tp_free(lz);
|
||||
}
|
||||
|
||||
static int
|
||||
|
@ -1807,7 +1807,7 @@ ifilter_next(ifilterobject *lz)
|
|||
PyObject *(*iternext)(PyObject *);
|
||||
|
||||
assert(PyIter_Check(it));
|
||||
iternext = *Py_Type(it)->tp_iternext;
|
||||
iternext = *Py_TYPE(it)->tp_iternext;
|
||||
for (;;) {
|
||||
item = iternext(it);
|
||||
if (item == NULL)
|
||||
|
@ -1931,7 +1931,7 @@ ifilterfalse_dealloc(ifilterfalseobject *lz)
|
|||
PyObject_GC_UnTrack(lz);
|
||||
Py_XDECREF(lz->func);
|
||||
Py_XDECREF(lz->it);
|
||||
Py_Type(lz)->tp_free(lz);
|
||||
Py_TYPE(lz)->tp_free(lz);
|
||||
}
|
||||
|
||||
static int
|
||||
|
@ -1951,7 +1951,7 @@ ifilterfalse_next(ifilterfalseobject *lz)
|
|||
PyObject *(*iternext)(PyObject *);
|
||||
|
||||
assert(PyIter_Check(it));
|
||||
iternext = *Py_Type(it)->tp_iternext;
|
||||
iternext = *Py_TYPE(it)->tp_iternext;
|
||||
for (;;) {
|
||||
item = iternext(it);
|
||||
if (item == NULL)
|
||||
|
@ -2253,7 +2253,7 @@ izip_dealloc(izipobject *lz)
|
|||
PyObject_GC_UnTrack(lz);
|
||||
Py_XDECREF(lz->ittuple);
|
||||
Py_XDECREF(lz->result);
|
||||
Py_Type(lz)->tp_free(lz);
|
||||
Py_TYPE(lz)->tp_free(lz);
|
||||
}
|
||||
|
||||
static int
|
||||
|
@ -2276,12 +2276,12 @@ izip_next(izipobject *lz)
|
|||
|
||||
if (tuplesize == 0)
|
||||
return NULL;
|
||||
if (Py_Refcnt(result) == 1) {
|
||||
if (Py_REFCNT(result) == 1) {
|
||||
Py_INCREF(result);
|
||||
for (i=0 ; i < tuplesize ; i++) {
|
||||
it = PyTuple_GET_ITEM(lz->ittuple, i);
|
||||
assert(PyIter_Check(it));
|
||||
item = (*Py_Type(it)->tp_iternext)(it);
|
||||
item = (*Py_TYPE(it)->tp_iternext)(it);
|
||||
if (item == NULL) {
|
||||
Py_DECREF(result);
|
||||
return NULL;
|
||||
|
@ -2297,7 +2297,7 @@ izip_next(izipobject *lz)
|
|||
for (i=0 ; i < tuplesize ; i++) {
|
||||
it = PyTuple_GET_ITEM(lz->ittuple, i);
|
||||
assert(PyIter_Check(it));
|
||||
item = (*Py_Type(it)->tp_iternext)(it);
|
||||
item = (*Py_TYPE(it)->tp_iternext)(it);
|
||||
if (item == NULL) {
|
||||
Py_DECREF(result);
|
||||
return NULL;
|
||||
|
@ -2403,7 +2403,7 @@ repeat_dealloc(repeatobject *ro)
|
|||
{
|
||||
PyObject_GC_UnTrack(ro);
|
||||
Py_XDECREF(ro->element);
|
||||
Py_Type(ro)->tp_free(ro);
|
||||
Py_TYPE(ro)->tp_free(ro);
|
||||
}
|
||||
|
||||
static int
|
||||
|
@ -2588,7 +2588,7 @@ izip_longest_dealloc(iziplongestobject *lz)
|
|||
Py_XDECREF(lz->ittuple);
|
||||
Py_XDECREF(lz->result);
|
||||
Py_XDECREF(lz->fillvalue);
|
||||
Py_Type(lz)->tp_free(lz);
|
||||
Py_TYPE(lz)->tp_free(lz);
|
||||
}
|
||||
|
||||
static int
|
||||
|
@ -2614,7 +2614,7 @@ izip_longest_next(iziplongestobject *lz)
|
|||
return NULL;
|
||||
if (lz->numactive == 0)
|
||||
return NULL;
|
||||
if (Py_Refcnt(result) == 1) {
|
||||
if (Py_REFCNT(result) == 1) {
|
||||
Py_INCREF(result);
|
||||
for (i=0 ; i < tuplesize ; i++) {
|
||||
it = PyTuple_GET_ITEM(lz->ittuple, i);
|
||||
|
@ -2623,7 +2623,7 @@ izip_longest_next(iziplongestobject *lz)
|
|||
item = lz->fillvalue;
|
||||
} else {
|
||||
assert(PyIter_Check(it));
|
||||
item = (*Py_Type(it)->tp_iternext)(it);
|
||||
item = (*Py_TYPE(it)->tp_iternext)(it);
|
||||
if (item == NULL) {
|
||||
lz->numactive -= 1;
|
||||
if (lz->numactive == 0) {
|
||||
|
@ -2652,7 +2652,7 @@ izip_longest_next(iziplongestobject *lz)
|
|||
item = lz->fillvalue;
|
||||
} else {
|
||||
assert(PyIter_Check(it));
|
||||
item = (*Py_Type(it)->tp_iternext)(it);
|
||||
item = (*Py_TYPE(it)->tp_iternext)(it);
|
||||
if (item == NULL) {
|
||||
lz->numactive -= 1;
|
||||
if (lz->numactive == 0) {
|
||||
|
@ -2783,7 +2783,7 @@ inititertools(void)
|
|||
NULL
|
||||
};
|
||||
|
||||
Py_Type(&teedataobject_type) = &PyType_Type;
|
||||
Py_TYPE(&teedataobject_type) = &PyType_Type;
|
||||
m = Py_InitModule3("itertools", module_methods, module_doc);
|
||||
if (m == NULL)
|
||||
return;
|
||||
|
|
|
@ -118,7 +118,7 @@ static PyObject * math_ceil(PyObject *self, PyObject *number) {
|
|||
return NULL;
|
||||
}
|
||||
|
||||
method = _PyType_Lookup(Py_Type(number), ceil_str);
|
||||
method = _PyType_Lookup(Py_TYPE(number), ceil_str);
|
||||
if (method == NULL)
|
||||
return math_1(number, ceil);
|
||||
else
|
||||
|
@ -148,7 +148,7 @@ static PyObject * math_floor(PyObject *self, PyObject *number) {
|
|||
return NULL;
|
||||
}
|
||||
|
||||
method = _PyType_Lookup(Py_Type(number), floor_str);
|
||||
method = _PyType_Lookup(Py_TYPE(number), floor_str);
|
||||
if (method == NULL)
|
||||
return math_1(number, floor);
|
||||
else
|
||||
|
|
|
@ -340,7 +340,7 @@ MD5_copy(MD5object *self, PyObject *unused)
|
|||
{
|
||||
MD5object *newobj;
|
||||
|
||||
if (Py_Type(self) == &MD5type) {
|
||||
if (Py_TYPE(self) == &MD5type) {
|
||||
if ( (newobj = newMD5object())==NULL)
|
||||
return NULL;
|
||||
} else {
|
||||
|
@ -552,7 +552,7 @@ init_md5(void)
|
|||
{
|
||||
PyObject *m;
|
||||
|
||||
Py_Type(&MD5type) = &PyType_Type;
|
||||
Py_TYPE(&MD5type) = &PyType_Type;
|
||||
if (PyType_Ready(&MD5type) < 0)
|
||||
return;
|
||||
m = Py_InitModule("_md5", MD5_functions);
|
||||
|
|
|
@ -1253,7 +1253,7 @@ PyMODINIT_FUNC
|
|||
PyObject *dict, *module;
|
||||
|
||||
/* Patch the object type */
|
||||
Py_Type(&mmap_object_type) = &PyType_Type;
|
||||
Py_TYPE(&mmap_object_type) = &PyType_Type;
|
||||
|
||||
module = Py_InitModule("mmap", mmap_functions);
|
||||
if (module == NULL)
|
||||
|
|
|
@ -694,7 +694,7 @@ build_node_children(PyObject *tuple, node *root, int *line_num)
|
|||
PyErr_Format(parser_error,
|
||||
"second item in terminal node must be a string,"
|
||||
" found %s",
|
||||
Py_Type(temp)->tp_name);
|
||||
Py_TYPE(temp)->tp_name);
|
||||
Py_DECREF(temp);
|
||||
Py_DECREF(elem);
|
||||
return 0;
|
||||
|
@ -708,7 +708,7 @@ build_node_children(PyObject *tuple, node *root, int *line_num)
|
|||
PyErr_Format(parser_error,
|
||||
"third item in terminal node must be an"
|
||||
" integer, found %s",
|
||||
Py_Type(temp)->tp_name);
|
||||
Py_TYPE(temp)->tp_name);
|
||||
Py_DECREF(o);
|
||||
Py_DECREF(temp);
|
||||
Py_DECREF(elem);
|
||||
|
@ -3056,7 +3056,7 @@ initparser(void)
|
|||
{
|
||||
PyObject *module, *copyreg;
|
||||
|
||||
Py_Type(&PyST_Type) = &PyType_Type;
|
||||
Py_TYPE(&PyST_Type) = &PyType_Type;
|
||||
module = Py_InitModule("parser", parser_functions);
|
||||
if (module == NULL)
|
||||
return;
|
||||
|
|
|
@ -2706,7 +2706,7 @@ extract_time(PyObject *t, long* sec, long* usec)
|
|||
long intval;
|
||||
if (PyFloat_Check(t)) {
|
||||
double tval = PyFloat_AsDouble(t);
|
||||
PyObject *intobj = Py_Type(t)->tp_as_number->nb_int(t);
|
||||
PyObject *intobj = Py_TYPE(t)->tp_as_number->nb_int(t);
|
||||
if (!intobj)
|
||||
return -1;
|
||||
intval = PyLong_AsLong(intobj);
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue