ERP5Type/patches/Restricted: allow pytz exceptions
When using the public API of pandas (which is partially allowed in restricted python), it can happen that this public API raises the error 'pytz.NonExistentTimeError' [1]. Users should be allowed to import and therefore catch this exception. Before this patch we could only do: >>> try: ... ts.tz_localize(tz) ... except Exception: ... ... After this patch we can do; >>> try: ... ts.tz_localize(tz) ... except pytz.NonExistentTimeError: ... ... pytz delivers more exceptions which are all equally harmless. We can therefore in the same patch also allow them, as they may be useful for similar cases. This patch also comes with tests which ensure that the allowed exceptions can be imported into restricted python and also a test to ensure no other objects in the pytz namespace can be used. --- [1] https://pandas.pydata.org/pandas-docs/version/2.0.3/reference/api/pandas.Series.tz_localize.html /reviewed-by @jerome /reviewed-on !1802
Status | Job ID | Name | Coverage | ||||||
---|---|---|---|---|---|---|---|---|---|
External | |||||||||
failed |
#606892
external
|
ERP5.CodingStyleTest-Master |
00:39:10
|
||||||
passed |
#606887
external
|
ERP5.PerformanceTest-Master |
00:26:48
|
||||||
passed |
#606886
external
|
ERP5.UnitTest-Master |
01:18:18
|
||||||
failed |
#606893
external
|
ERP5.UnitTest-Zope2 |
01:40:37
|
||||||
passed |
#606901
external
|
SlapOS.Eggs.UnitTest-Master.Python2 |
00:14:08
|
||||||
passed |
#606917
external
|
SlapOS.Eggs.UnitTest-Master.Python3 |
00:15:32
|
||||||
passed |
#606890
external
|
Wendelin.UnitTest-Master |
00:22:52
|
||||||