Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cython pure python declare #8025

Closed
wants to merge 9 commits into from
3 changes: 3 additions & 0 deletions doc/whatsnew/fragments/8024.false_positive
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Added test for pure Python ``cython.declare`` usage, which should be valid no matter what is imported from the cython module.

Refs #8024
13 changes: 13 additions & 0 deletions tests/functional/r/regression_02/regression_cython_declare_8024.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
"""Test for cython pure Python false positives"""
import cython

# cython allows any import in pure Python mode. It can only
# be determined correct at compile time
# Check that it raises neither an import-error nor a
# no-name-in-module error
from cython.cimports.libc.math import sin

# Same with type declarations
# Check it doesn't generate a no-member error
MY_VAR = cython.declare(cython.int, 0)
print(sin(MY_VAR))
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[BASIC]
ignored-modules: non_existant_module

[testoptions]
requires: cython