Skip to content
GitLab
Projects Groups Topics Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Register
  • Sign in
  • erp5 erp5
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributor statistics
    • Graph
    • Compare revisions
  • Merge requests 142
    • Merge requests 142
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Jobs
  • Commits
Collapse sidebar
  • nexedinexedi
  • erp5erp5
  • Merge requests
  • !1802

Allow pytz.exceptions.NonExistentTimeError in restricted python to catch error of pd API

  • Review changes

  • Download
  • Patches
  • Plain diff
Merged Levin Zimmermann requested to merge levin.zimmermann/erp5:pytz into master Jul 23, 2023
  • Overview 9
  • Commits 1
  • Pipelines 0
  • Changes 2

Hello,

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.exceptions.NonExistentTimeError. 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.exceptions.NonExistentTimeError:
...   ...

We use this in some scripts in the WWM project.

I can't think of any security issues when allowing this exception. As far as I can see it's really just an unaltered subclass of Exception.

I already submitted a test run on a test node. There are some failed tests, but I don't think they are related.

Best, Levin

/cc @jerome @klaus

Assignee
Assign to
Reviewers
Request review from
Time tracking
Source branch: pytz
GitLab Nexedi Edition | About GitLab | About Nexedi | 沪ICP备2021021310号-2 | 沪ICP备2021021310号-7