Skip to content

convert_date returns 'str' object instead of None for illegal values #993

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

Closed
p3dda opened this issue Aug 2, 2021 · 1 comment · Fixed by #994
Closed

convert_date returns 'str' object instead of None for illegal values #993

p3dda opened this issue Aug 2, 2021 · 1 comment · Fixed by #994

Comments

@p3dda
Copy link

p3dda commented Aug 2, 2021

Describe the bug

According to docstrings for the convert_date method, illegal values should be returned as None. In fact, the method returns the original date value as string

To Reproduce

Code:

import pymysql.converters

pymysql.converters.convert_date('2007-02-31')
pymysql.converters.convert_date('0000-00-00')

Returned values are '2007-02-31' and '0000-00-00'

Expected behavior

According to the docstring, expected return values would be None:

      >>> convert_date('2007-02-31') is None
      True
      >>> convert_date('0000-00-00') is None
      True

Environment

  • OS: Linux
  • PyMySQL version: 1.0.2
@methane
Copy link
Member

methane commented Aug 3, 2021

It is intentional behavior. See #520.

docstring is outdated.

methane added a commit to methane/PyMySQL that referenced this issue Aug 3, 2021
methane added a commit that referenced this issue Aug 3, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 4, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants