maxcountryman / maxcountryman/flask-bcrypt
TypeError in function
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 327
- Forks
- 65
- PR merge metrics
- No merged PRs in 30d
Description
In flask_bcrypt.py, I noticed a TypeError in (commit d9064521998846a59a98f311e3bd135e1dfe082c) function Bcrypt.generate_password_hash() as:
TypeError: gensalt() got an unexpected keyword argument 'rounds'
Complete error
Traceback (most recent call last):
File "/home/amarnathk/.local/lib/python3.12/site-packages/flask/app.py", line 1498, in __call__
return self.wsgi_app(environ, start_response)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/amarnathk/.local/lib/python3.12/site-packages/flask/app.py", line 1476, in wsgi_app
response = self.handle_exception(e)
^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/amarnathk/.local/lib/python3.12/site-packages/flask/app.py", line 1473, in wsgi_app
response = self.full_dispatch_request()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/amarnathk/.local/lib/python3.12/site-packages/flask/app.py", line 882, in full_dispatch_request
rv = self.handle_user_exception(e)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/amarnathk/.local/lib/python3.12/site-packages/flask/app.py", line 880, in full_dispatch_request
rv = self.dispatch_request()
^^^^^^^^^^^^^^^^^^^^^^^
File "/home/amarnathk/.local/lib/python3.12/site-packages/flask/app.py", line 865, in dispatch_request
return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args) # type: ignore[no-any-return]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/amarnathk/urmom/python/school-flask/app.py", line 116, in admin_login
pwhash = bcrypt.generate_password_hash(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/amarnathk/.local/lib/python3.12/site-packages/flask_bcrypt.py", line 199, in generate_password_hash
salt = bcrypt.gensalt(rounds=rounds, prefix=prefix)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: gensalt() got an unexpected keyword argument 'rounds'
As far as I know, bcrypt.gensalt(rounds=rounds, prefix=prefix) should be bcrypt.gensalt(log_rounds=rounds, prefix=prefix).
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in flask_bcrypt.py at Bcrypt.generate_password_hash(), where the traceback shows bcrypt.gensalt() is called with rounds. Check the installed bcrypt API and the surrounding password-hashing behavior. Done means the function no longer raises this TypeError and password-hash generation still works with the requested rounds and prefix.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- flask, python
- Domain
- security
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 48/100