Skip to content

Commit 747afca

Browse files
authored
BUG: Period.now not taking kwargs (pandas-dev#53375)
1 parent e1808b8 commit 747afca

File tree

6 files changed

+10
-5
lines changed

6 files changed

+10
-5
lines changed

doc/source/whatsnew/v2.1.0.rst

+1
Original file line numberDiff line numberDiff line change
@@ -528,6 +528,7 @@ Period
528528
- Bug in :class:`PeriodDtype` constructor raising ``ValueError`` instead of ``TypeError`` when an invalid type is passed (:issue:`51790`)
529529
- Bug in :func:`read_csv` not processing empty strings as a null value, with ``engine="pyarrow"`` (:issue:`52087`)
530530
- Bug in :func:`read_csv` returning ``object`` dtype columns instead of ``float64`` dtype columns with ``engine="pyarrow"`` for columns that are all null with ``engine="pyarrow"`` (:issue:`52087`)
531+
- Bug in :meth:`Period.now` not accepting the ``freq`` parameter as a keyword argument (:issue:`53369`)
531532
- Bug in :meth:`arrays.PeriodArray.map` and :meth:`PeriodIndex.map`, where the supplied callable operated array-wise instead of element-wise (:issue:`51977`)
532533
- Bug in incorrectly allowing construction of :class:`Period` or :class:`PeriodDtype` with :class:`CustomBusinessDay` freq; use :class:`BusinessDay` instead (:issue:`52534`)
533534

pandas/_libs/meson.build

+1-1
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ foreach ext_name, ext_dict : libs_sources
105105
py.extension_module(
106106
ext_name,
107107
ext_dict.get('sources'),
108-
cython_args: ['--include-dir', meson.current_build_dir()],
108+
cython_args: ['--include-dir', meson.current_build_dir(), '-X always_allow_keywords=true'],
109109
include_directories: [inc_np, inc_pd],
110110
dependencies: ext_dict.get('deps', ''),
111111
subdir: 'pandas/_libs',

pandas/_libs/tslibs/meson.build

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ foreach ext_name, ext_dict : tslibs_sources
2323
py.extension_module(
2424
ext_name,
2525
ext_dict.get('sources'),
26-
cython_args: ['--include-dir', meson.current_build_dir()],
26+
cython_args: ['--include-dir', meson.current_build_dir(), '-X always_allow_keywords=true'],
2727
include_directories: [inc_np, inc_pd],
2828
dependencies: ext_dict.get('deps', ''),
2929
subdir: 'pandas/_libs/tslibs',

pandas/_libs/window/meson.build

+2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
py.extension_module(
22
'aggregations',
33
['aggregations.pyx'],
4+
cython_args: ['-X always_allow_keywords=true'],
45
include_directories: [inc_np, inc_pd],
56
dependencies: [py_dep],
67
subdir: 'pandas/_libs/window',
@@ -11,6 +12,7 @@ py.extension_module(
1112
py.extension_module(
1213
'indexers',
1314
['indexers.pyx'],
15+
cython_args: ['-X always_allow_keywords=true'],
1416
include_directories: [inc_np, inc_pd],
1517
dependencies: [py_dep],
1618
subdir: 'pandas/_libs/window',

pandas/tests/scalar/period/test_period.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -72,14 +72,16 @@ def test_construction(self):
7272
assert i1 != i4
7373
assert i4 == i5
7474

75-
i1 = Period.now("Q")
75+
i1 = Period.now(freq="Q")
7676
i2 = Period(datetime.now(), freq="Q")
7777
i3 = Period.now("q")
7878

7979
assert i1 == i2
8080
assert i1 == i3
8181

82-
i1 = Period.now("D")
82+
# Pass in freq as a keyword argument sometimes as a test for
83+
# https://github.com/pandas-dev/pandas/issues/53369
84+
i1 = Period.now(freq="D")
8385
i2 = Period(datetime.now(), freq="D")
8486
i3 = Period.now(offsets.Day())
8587

setup.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -376,7 +376,7 @@ def run(self):
376376
# Note: if not using `cythonize`, coverage can be enabled by
377377
# pinning `ext.cython_directives = directives` to each ext in extensions.
378378
# github.com/cython/cython/wiki/enhancements-compilerdirectives#in-setuppy
379-
directives = {"linetrace": False, "language_level": 3}
379+
directives = {"linetrace": False, "language_level": 3, "always_allow_keywords": True}
380380
macros = []
381381
if linetrace:
382382
# https://pypkg.com/pypi/pytest-cython/f/tests/example-project/setup.py

0 commit comments

Comments
 (0)