Skip to content

BUG: Period.now not taking kwargs #53375

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

Merged
merged 6 commits into from
Jul 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions doc/source/whatsnew/v2.1.0.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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`)

Expand Down
2 changes: 1 addition & 1 deletion pandas/_libs/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
2 changes: 1 addition & 1 deletion pandas/_libs/tslibs/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
2 changes: 2 additions & 0 deletions pandas/_libs/window/meson.build
Original file line number Diff line number Diff line change
@@ -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',
Expand All @@ -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',
Expand Down
6 changes: 4 additions & 2 deletions pandas/tests/scalar/period/test_period.py
Original file line number Diff line number Diff line change
Expand Up @@ -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())

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down