lists.arthurdejong.org
RSS feed

stdnum.se.personnummer is_valid is crashing under a given input

[Date Prev][Date Next] [Thread Prev][Thread Next]

stdnum.se.personnummer is_valid is crashing under a given input



Hi

Thanks for the great library – it really helps us 😊

 

I have code that calls the is_valid method of  stdnum.se.personnummer.

The input I am sending is “breaking” the birthday calculation and I believe should be fixed.

The code below reproduces the issue

 

from stdnum.se.personnummer import is_valid

is_valid(
'19670-19-9535')

 

The output is:

 

Traceback (most recent call last):

  File "C:/dev/projects/waf-ai-repo/reproduce_stdnum_issue.py", line 3, in <module>

    is_valid('19670-19-9535')

  File "C:\dev\tools\python371\lib\site-packages\stdnum\se\personnummer.py", line 118, in is_valid

    return bool(validate(number))

  File "C:\dev\tools\python371\lib\site-packages\stdnum\se\personnummer.py", line 110, in validate

    get_birth_date(number)

  File "C:\dev\tools\python371\lib\site-packages\stdnum\se\personnummer.py", line 73, in get_birth_date

    month = int(number[4:6])

ValueError: invalid literal for int() with base 10: '0-'

 

 

Thanks

 

Avishay

 

 

Sent from Mail for Windows 10