Potential Incompatibilities with Earlier Versions

This section describes incompatibilities introduced by particular versions of SIP. Normally these are the removal of previously deprecated features.

SIP v4.19

Deprecation of Module Version Number

Prior to this version, the %Module directive allowed a version number to be specified for a module. This was then checked against the version numbers (if specified) of any other modules that imported it. This was intended to detect when binary incompatible modules where being used.

Starting with this version the version number is deprecated and is simply ignored. Other internal changes have eliminated the need for this feature.

Generated Type Structures for Imported Types

As described in Generated Type Structures SIP generates a type structure for each C structure, C++ class and namespace, mapped type and named enum. Prior to this version every type structure in a module was automatically available to any handwritten code in any module that imported it.

Starting with this version only those type structures needed by the generated code are automatically available to handwritten code possibly resulting in compiler errors. Handwritten code should be changed to call sipFindType() to obtain a pointer to the required type structure.

SIP v4.16

Prior to this version, if no valid version tag was specified using the -t command line option to sip then all versions of the corresponding timeline were considered disabled.

Starting with this version SIP assumes that the latest version is enabled if no valid version tag was specified. Exactly what is meant by the latest version can be changed by using the -B command line option to define a backstop for a timeline. See the %Timeline directive for more details.

SIP v4.14.4

Prior to this version, the handwritten code defined by the %VirtualErrorHandler directive was called without the Python Global Interpreter Lock (GIL) being held and from an arbitrary thread.

Starting with this version the code is called with the GIL being held and from the thread that raised the error. In addition the code is provided a value called sipGILState that may be passed to SIP_RELEASE_GIL() in order to release the GIL. This must be done if the code changes the execution path (e.g. by throwing a C++ exception).

SIP v4.12.3

Prior to this version, when SIP searches a class hierachy to see if there is a Python reimplementation of a virtual C++ method, it ignored any objects that were not Python functions or methods.

Starting with this version such an object is not ignored and will be called. If it is not callable then a Python exception will be raised. For example, the following code will now raise an excepton because the Mixin.event attribute will now be called as it is assumed to be a valid reimplementation of QObject.event():

class Mixin:
    event = False

class MyObject(QObject, Mixin):
    pass

SIP v4.12

Prior to this version several directives ignored any enclosing %If directive. Starting with this version all directives are affected by the %If directive.

SIP v4.10.1

Newly Deprecated Features

The following parts of the C API are now deprecated (but still supported).

SIP v4.8

__truediv__

Prior to this version the __div__() special method implicitly defined the __truediv__() special method. From this version the __truediv__() special method must be explicitly defined.

sipWrapper user Member

Prior to this version the sipWrapper structure had a member called user which is available for handwritten code to use. From this version user is a member of the sipSimpleWrapper structure.

sipWrapper pointers can be safely cast to sipSimpleWrapper pointers, so if your code does something like:

((sipWrapper *)obj)->user = an_object_reference;

then you just need to change it to:

((sipSimpleWrapper *)obj)->user = an_object_reference;

Removal of Previously Deprecated Features

The following parts of the C API have been removed.

  • The a, A, M, N, O, P and T format characters from sipBuildResult() and sipCallMethod().
  • The a, A, L and M format characters from sipParseResult().
  • sipConvertToCpp()
  • sipIsSubClassInstance()
  • sipTransfer()
  • The transfer() function of the sip module.
  • The old-style generated type convertors.

In addition the -a command line option to configure.py has been removed.

Removal of PyQt-specific Features

The following PyQt-specific support functions have been removed.

  • sipConnectRx()
  • sipDisconnectRx()
  • sipEmitSlot()
  • sipGetSender()

SIP v4.7.8

Automatic int to Enum Conversions

This version allows a Python int object to be passed whenever an enum is expected. This can mean that two signatures that were different with prior versions are now the same as far as Python is concerned.

The Constrained argument annotation can now be applied to an enum argument to revert to the earlier behaviour.

SIP v4.7.3

Complementary Comparison Operators

Prior to this version SIP did not automatically generate missing complementary comparison operators. Typically this was worked around by adding them explicitly to the .sip files, even though they weren’t implemented in C++ and relied on the C++ compiler calling the complementary operator that was implemented.

A necessary change to the code generator meant that this not longer worked and so SIP was changed to automatically generate any missing complementary operators. If you have added such operators explicitly then you should remove them or make them dependent on the particular version of SIP.

SIP v4.4

%ConvertFromTypeCode and %ConvertToTypeCode

Handwritten %ConvertFromTypeCode and %ConvertToTypeCode now have the responsibility for implementing the Transfer and TransferBack annotations.

SIP_BUILD

The SIP_BUILD C preprocessor symbol has been removed.

Newly Deprecated Features

The following parts of the C API are now deprecated (but still supported).

  • The old-style generated type convertors.
  • sipConvertToCpp()
  • sipIsSubClassInstance()