unionai-oss / pandera

A light-weight, flexible, and expressive statistical data testing library
https://www.union.ai/pandera
MIT License
3.05k stars 281 forks source link

Add _GenericAlias.__call__ patch #1561

Closed cosmicBboy closed 1 month ago

cosmicBboy commented 1 month ago

Fixes #1559

This PR patches typing._GenericAlias.__call__, which was changed in python 3.11.9 such that it ignores all exceptions when the __orig_class__ attribute is set. This is the dark magic that pandera relies on to enable the validation-on-init feature when using pandera.typing.DataFrame[Schema](...).