Skip to content

Commit 138bb42

Browse files
committed
Resolve Interval
1 parent b093091 commit 138bb42

File tree

4 files changed

+8
-4
lines changed

4 files changed

+8
-4
lines changed

meson.build

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ versioneer = files('generate_version.py')
1818

1919
add_project_arguments('-DNPY_NO_DEPRECATED_API=0', language: 'c')
2020
add_project_arguments('-DNPY_NO_DEPRECATED_API=0', language: 'cpp')
21+
# Enables settings __module__ on cdef classes
22+
# https://github.com/cython/cython/issues/7231
23+
add_project_arguments('-DCYTHON_USE_TYPE_SPECS=1', language: 'c')
2124

2225
# Allow supporting older numpys than the version compiled against
2326
# Set the define to the min supported version of numpy for pandas

pandas/_libs/interval.pyx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -445,6 +445,7 @@ cdef class Interval(IntervalMixin):
445445
>>> interval.closed
446446
'left'
447447
"""
448+
__module__ = "pandas"
448449

449450
def __init__(self, left, right, str closed="right"):
450451
# note: it is faster to just do these checks than to use a special

pandas/tests/api/test_api.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -643,9 +643,6 @@ def test_attributes_module(module_name):
643643
# Explicit exceptions
644644
or ("Dtype" in name and obj.__module__ == "pandas")
645645
or (name == "Categorical" and obj.__module__ == "pandas")
646-
# Setting __module__ on a cdef class has no effect
647-
# https://github.com/cython/cython/issues/7231
648-
or name == "Interval"
649646
)
650647
]
651648
assert len(failures) == 0, failures

setup.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,7 @@ def run(self) -> None:
321321
endian_macro = [("__LITTLE_ENDIAN__", "1")]
322322

323323

324-
extra_compile_args = []
324+
extra_compile_args = ["-DCYTHON_USE_TYPE_SPECS=1"]
325325
extra_link_args = []
326326
if is_platform_windows():
327327
if debugging_symbols_requested:
@@ -569,6 +569,9 @@ def srcpath(name=None, suffix=".pyx", subdir="src"):
569569
extra_compile_args.append("-qlanglvl=extended0x:nolibext")
570570
undef_macros.append("_POSIX_THREADS")
571571

572+
print("-" * 80)
573+
print(extra_compile_args)
574+
print("-" * 80)
572575
obj = Extension(
573576
f"pandas.{name}",
574577
sources=sources,

0 commit comments

Comments
 (0)