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

[BUGFIX] scrapy compatibility - handle dir() inconsistencies #9830

Merged
merged 3 commits into from
Apr 29, 2024
Merged

Conversation

Kilo59
Copy link
Contributor

@Kilo59 Kilo59 commented Apr 29, 2024

The current code assumes that all attr names returned by dir(cls) must actually exist on the class but per official python documentation, this is not guaranteed.
https://docs.python.org/3.10/library/functions.html#dir

Dynamic alteration of classes through metaclasses or other methods can result in dir(cls) returning an attribute that is not retrievable by getattr() and leads to an error.

#9698 (comment)

References

@Kilo59 Kilo59 linked an issue Apr 29, 2024 that may be closed by this pull request
@Kilo59 Kilo59 changed the title handle dir() inconsistencies [BUGFIX ] handle dir() inconsistencies Apr 29, 2024
@Kilo59 Kilo59 self-assigned this Apr 29, 2024
@Kilo59 Kilo59 changed the title [BUGFIX ] handle dir() inconsistencies [BUGFIX] handle dir() inconsistencies Apr 29, 2024
@Kilo59 Kilo59 marked this pull request as ready for review April 29, 2024 14:14
@Kilo59 Kilo59 changed the title [BUGFIX] handle dir() inconsistencies [BUGFIX] Fix Scrapy compatibility - handle dir() inconsistencies Apr 29, 2024
@Kilo59 Kilo59 changed the title [BUGFIX] Fix Scrapy compatibility - handle dir() inconsistencies [BUGFIX] scrapy compatibility - handle dir() inconsistencies Apr 29, 2024
@Kilo59 Kilo59 enabled auto-merge April 29, 2024 14:15
Copy link
Contributor

@tyler-hoffman tyler-hoffman left a comment

Choose a reason for hiding this comment

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

TIL

@Kilo59 Kilo59 requested a review from NathanFarmer April 29, 2024 14:30
@Kilo59 Kilo59 added this pull request to the merge queue Apr 29, 2024
Merged via the queue into 0.18.x with commit bf94a26 Apr 29, 2024
83 of 85 checks passed
@Kilo59 Kilo59 deleted the scrapy-fix branch April 29, 2024 15:21
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.

Great Expectations and Scrapy - not working in same virtual environment
4 participants