Skip to content

Handle changes from Cython 3.0 #47

@bbassett-tibco

Description

@bbassett-tibco

In updating one of my development environments, I discovered that Cython has released version 3.0 after our 2.0.1.post1 release. This exposes a few issues (none of which are fatal) with our implementation:

  • While we were getting a warning about using a deprecated NumPy API under Cython 0.29, Cython 3.0 now makes it possible to remove the warning. Use the migration guide to update the build appropriately.

    .../lib/python3.11/site-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:17:2: warning: #warning "Using deprecated NumPy API, disable it with " "#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION"
    
  • It appears that Cython 3.0 deprecated the "DEF" statement (Deprecate conditional compilation cython/cython#4310). This affects the sbdf.pyx module, but only for the static constants used to process dates, times, and decimal values. Refactor this usage to avoid triggering the (currently) warning.

    warning: spotfire/sbdf.pyx:82:0: The 'DEF' statement is deprecated and will be removed in a future Cython version. Consider using global variables, constants, and in-place literals instead. See https://github.com/cython/cython/issues/4310
    warning: spotfire/sbdf.pyx:83:0: The 'DEF' statement is deprecated and will be removed in a future Cython version. Consider using global variables, constants, and in-place literals instead. See https://github.com/cython/cython/issues/4310
    warning: spotfire/sbdf.pyx:84:0: The 'DEF' statement is deprecated and will be removed in a future Cython version. Consider using global variables, constants, and in-place literals instead. See https://github.com/cython/cython/issues/4310
    warning: spotfire/sbdf.pyx:103:0: The 'DEF' statement is deprecated and will be removed in a future Cython version. Consider using global variables, constants, and in-place literals instead. See https://github.com/cython/cython/issues/4310
    
  • Along with the "DEF" statement, the "IF" statement used to conditionalize the platform-specific code in codesign.pyx and cabfile.pyx is now deprecated also. Since the recommended options don't work well for platform-specific code, we need to refactor these modules so that the platform-specific code is in separate files and the conditionality is moved into the setup.py script (making sure to remove the current logic that excludes the generated C files from the distribution and the cython_c_in_temp flag on the Extension objects).

    warning: spotfire/cabfile.pyx:11:0: The 'IF' statement is deprecated and will be removed in a future Cython version. Consider using runtime conditions or C macros instead. See https://github.com/cython/cython/issues/4310
    warning: spotfire/codesign.pyx:10:0: The 'IF' statement is deprecated and will be removed in a future Cython version. Consider using runtime conditions or C macros instead. See https://github.com/cython/cython/issues/4310
    
  • It appears that Cython 3.0 has updated exception handling propagation for cdef functions declared without except clauses. While this should automatically fix part of Issues with Writing Spatial Data in WKB Format to SBDF Files Using export_data Function #44, we should check other uses and either move to using the new "noexcept" clause where exceptions should not be propagated, or remove places where we explicitly added "except *" clauses to force propagation.

Fix these issues and update the minimum requirement to Cython 3.0.

Metadata

Metadata

Labels

bugSomething isn't workingecosystemIssues arising from interactions with the broader Python packaging ecosystem

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions