Skip to content
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

fix: Prevent crash with 'gevent' has no attribute 'version_info' #539

Merged
merged 1 commit into from
Jun 12, 2024

Conversation

Ferenc-
Copy link
Collaborator

@Ferenc- Ferenc- commented Jun 12, 2024

If the gevent module is not installed,
but there is a directory called gevent
or a gevent.py file in the current directory,
then that is already importable and the statment
if sys.modules['gevent'].version_info < (1, 4):
fails with
AttributeError: module 'gevent' has no attribute 'version_info'

This can happen easily since many libraries like celery, grpc, opentracing etc, deliver their own file called gevent.py.

@Ferenc- Ferenc- requested review from pvital and GSVarsha June 12, 2024 08:15
Copy link
Contributor

@GSVarsha GSVarsha left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me!

If the `gevent` module is not installed,
but there is a directory called `gevent`
or a `gevent.py` file in the current directory,
then that is already importable and the statment
`if sys.modules['gevent'].version_info < (1, 4):`
fails with
`AttributeError: module 'gevent' has no attribute 'version_info'`

This can happen easily since many libraries like `celery`, `grpc`, `opentracing` etc,
deliver their own file called `gevent.py`.

Signed-off-by: Ferenc Géczi <ferenc.geczi@ibm.com>
Copy link
Member

@pvital pvital left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks good to me.

@Ferenc- Ferenc- merged commit 9006c03 into master Jun 12, 2024
13 checks passed
@Ferenc- Ferenc- deleted the fix-gevent-crash branch June 12, 2024 15:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants