Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
erp5 erp5
  • Project overview
    • Project overview
    • Details
    • Activity
    • Releases
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Labels
    • Labels
  • Merge requests 141
    • Merge requests 141
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Operations
    • Operations
    • Environments
  • Analytics
    • Analytics
    • CI/CD
    • Repository
    • Value Stream
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Members
    • Members
  • Activity
  • Graph
  • Jobs
  • Commits
Collapse sidebar
  • nexedi
  • erp5erp5
  • Merge requests
  • !1802

Merged
Created Jul 23, 2023 by Levin Zimmermann@levin.zimmermannMaintainer

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

  • Overview 9
  • Commits 1
  • 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
Reviewer
Request review from
None
Milestone
None
Assign milestone
Time tracking
Source branch: pytz
GitLab Nexedi Edition | About GitLab | About Nexedi | 沪ICP备2021021310号-2 | 沪ICP备2021021310号-7