diff --git a/doc/source/whatsnew/v2.1.0.rst b/doc/source/whatsnew/v2.1.0.rst index 44e091e12bfa6..b7cc254d5c7e5 100644 --- a/doc/source/whatsnew/v2.1.0.rst +++ b/doc/source/whatsnew/v2.1.0.rst @@ -528,6 +528,7 @@ Period - Bug in :class:`PeriodDtype` constructor raising ``ValueError`` instead of ``TypeError`` when an invalid type is passed (:issue:`51790`) - Bug in :func:`read_csv` not processing empty strings as a null value, with ``engine="pyarrow"`` (:issue:`52087`) - 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`) +- Bug in :meth:`Period.now` not accepting the ``freq`` parameter as a keyword argument (:issue:`53369`) - Bug in :meth:`arrays.PeriodArray.map` and :meth:`PeriodIndex.map`, where the supplied callable operated array-wise instead of element-wise (:issue:`51977`) - Bug in incorrectly allowing construction of :class:`Period` or :class:`PeriodDtype` with :class:`CustomBusinessDay` freq; use :class:`BusinessDay` instead (:issue:`52534`) diff --git a/pandas/_libs/meson.build b/pandas/_libs/meson.build index 5e59f15d0d089..f302c649bc7bd 100644 --- a/pandas/_libs/meson.build +++ b/pandas/_libs/meson.build @@ -105,7 +105,7 @@ foreach ext_name, ext_dict : libs_sources py.extension_module( ext_name, ext_dict.get('sources'), - cython_args: ['--include-dir', meson.current_build_dir()], + cython_args: ['--include-dir', meson.current_build_dir(), '-X always_allow_keywords=true'], include_directories: [inc_np, inc_pd], dependencies: ext_dict.get('deps', ''), subdir: 'pandas/_libs', diff --git a/pandas/_libs/tslibs/meson.build b/pandas/_libs/tslibs/meson.build index 4a51f8dc1e461..14d2eef46da20 100644 --- a/pandas/_libs/tslibs/meson.build +++ b/pandas/_libs/tslibs/meson.build @@ -23,7 +23,7 @@ foreach ext_name, ext_dict : tslibs_sources py.extension_module( ext_name, ext_dict.get('sources'), - cython_args: ['--include-dir', meson.current_build_dir()], + cython_args: ['--include-dir', meson.current_build_dir(), '-X always_allow_keywords=true'], include_directories: [inc_np, inc_pd], dependencies: ext_dict.get('deps', ''), subdir: 'pandas/_libs/tslibs', diff --git a/pandas/_libs/window/meson.build b/pandas/_libs/window/meson.build index 61719a35b2346..b83d8730f9447 100644 --- a/pandas/_libs/window/meson.build +++ b/pandas/_libs/window/meson.build @@ -1,6 +1,7 @@ py.extension_module( 'aggregations', ['aggregations.pyx'], + cython_args: ['-X always_allow_keywords=true'], include_directories: [inc_np, inc_pd], dependencies: [py_dep], subdir: 'pandas/_libs/window', @@ -11,6 +12,7 @@ py.extension_module( py.extension_module( 'indexers', ['indexers.pyx'], + cython_args: ['-X always_allow_keywords=true'], include_directories: [inc_np, inc_pd], dependencies: [py_dep], subdir: 'pandas/_libs/window', diff --git a/pandas/tests/scalar/period/test_period.py b/pandas/tests/scalar/period/test_period.py index d908c641a30c6..1e8c2bce1d90d 100644 --- a/pandas/tests/scalar/period/test_period.py +++ b/pandas/tests/scalar/period/test_period.py @@ -72,14 +72,16 @@ def test_construction(self): assert i1 != i4 assert i4 == i5 - i1 = Period.now("Q") + i1 = Period.now(freq="Q") i2 = Period(datetime.now(), freq="Q") i3 = Period.now("q") assert i1 == i2 assert i1 == i3 - i1 = Period.now("D") + # Pass in freq as a keyword argument sometimes as a test for + # https://github.com/pandas-dev/pandas/issues/53369 + i1 = Period.now(freq="D") i2 = Period(datetime.now(), freq="D") i3 = Period.now(offsets.Day()) diff --git a/setup.py b/setup.py index e285299cfc05e..b87f81e0d8292 100755 --- a/setup.py +++ b/setup.py @@ -376,7 +376,7 @@ def run(self): # Note: if not using `cythonize`, coverage can be enabled by # pinning `ext.cython_directives = directives` to each ext in extensions. # github.com/cython/cython/wiki/enhancements-compilerdirectives#in-setuppy -directives = {"linetrace": False, "language_level": 3} +directives = {"linetrace": False, "language_level": 3, "always_allow_keywords": True} macros = [] if linetrace: # https://pypkg.com/pypi/pytest-cython/f/tests/example-project/setup.py